Skip to content

Latest commit

 

History

History
63 lines (53 loc) · 826 Bytes

File metadata and controls

63 lines (53 loc) · 826 Bytes

E-Commerce Store Schema Design

SQL Model (Normalized)

Customers

  • customer_id (Primary Key)
  • name
  • email

Products

  • product_id (Primary Key)
  • name
  • price

Orders

  • order_id (Primary Key)
  • customer_id (Foreign Key → Customers)
  • order_date

OrderItems

  • order_id (Foreign Key → Orders)
  • product_id (Foreign Key → Products)
  • qty
  • unit_price

NoSQL Model (MongoDB Example)

customers

{
  "customer_id": 1,
  "name": "Alice Smith",
  "email": "alicesmith@gmail.com"
}

products

{
  "product_id": 1,
  "name": "Laptop",
  "price": 999.99
}

orders

{
  "order_id": 1,
  "customer_id": 1,
  "order_date": "2023-10-01",
  "items": [
    {
      "product_id": 1,
      "name": "Laptop",
      "qty": 1,
      "unit_price": 999.99
    }
  ]
}