Explore Core Data Concepts in Microsoft Azure

Notes on Relational Databases:

  1. Purpose of Relational Databases:

    • Used to store and organize information for quick and easy retrieval.
    • Example: eCommerce systems store details about customers, products, and orders.
  2. Key Concepts:

    • Entities: Represent real-world objects or things (e.g., customers, products, orders).
    • Tables: Used to model entities; each table contains rows and columns.
    • Rows: Represent individual instances of an entity (e.g., one customer or one order).
    • Columns: Define properties of the entity (e.g., customer name, product ID).
  3. Naming Best Practices:

    • Use one word for names (avoid spaces).
    • Use conventions like camelCase, PascalCase, or underscores for naming entities and fields (e.g., customerName or customer_id).
  4. Primary Keys (PK):

    • Uniquely identify each row in a table.
    • No two rows can have the same primary key.
  5. Foreign Keys (FK):

    • Used to link tables and maintain relationships between them.
    • Reference the primary key of another table.
    • Help prevent anomalies, like invalid orders for non-existent customers.
  6. Relationships Between Tables:

    • One-to-Many: One customer can have many orders, but each order belongs to a single customer.
    • Many-to-One: Several orders can be for the same product, but each order references a single product.
  7. Characteristics of Relational Databases:

    • Data is stored in tables.
    • All rows in a table have the same columns.
    • Tables can have any number of rows.
    • Primary keys ensure rows are unique.
    • Foreign keys link related tables.
  8. Normalization:

    • The process of splitting entities into multiple tables to avoid duplication and improve efficiency.

Example in eCommerce:

  • Customers Table: Contains customer details (e.g., name, address).
  • Products Table: Contains product details (e.g., name, price).
  • Orders Table: Links customers and products using foreign keys (customerID and productID).

Normalization and proper relationships ensure the database remains organized and scalable.

Comments