0% found this document useful (0 votes)
4 views6 pages

Design Schema For Amazon

The document outlines a robust relational schema for an e-commerce platform similar to Amazon, detailing core entities such as users, products, orders, and payments. It emphasizes the relationships between tables, normalization up to the third normal form, and scalability considerations for large-scale systems. The schema is designed to support user management, product cataloging, shopping carts, order processing, and payment handling.

Uploaded by

skushal.mys
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views6 pages

Design Schema For Amazon

The document outlines a robust relational schema for an e-commerce platform similar to Amazon, detailing core entities such as users, products, orders, and payments. It emphasizes the relationships between tables, normalization up to the third normal form, and scalability considerations for large-scale systems. The schema is designed to support user management, product cataloging, shopping carts, order processing, and payment handling.

Uploaded by

skushal.mys
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

design schema for amazon

Designing a schema for Amazon or a similar large-scale e-commerce platform involves modeling
core entities such as users, products, orders, payments, and more, with careful attention to
relationships, scalability, and performance. Below is a robust, normalized relational schema
suitable for an Amazon-like system, with explanations for each major table.

Core Tables and Relationships

Users
users
user_id (Primary Key)
name

email

password_hash

phone_number

created_at

last_login_at

Addresses
addresses
address_id (Primary Key)
user_id (Foreign Key)
street

city

state

postal_code

country

is_default (boolean)

User to Addresses is a one-to-many relationship: one user can have multiple addresses [1] [2] .
Categories
categories
category_id (Primary Key)
category_name

parent_id (Foreign Key, for hierarchical categories)


Categories can be organized hierarchically (main and subcategories) [1] [2] .

Products
products
product_id (Primary Key)
category_id (Foreign Key)
name

description

brand

created_at

updated_at

Product to Category is a many-to-many relationship, often managed via a join table if products
can belong to multiple categories [1] [3] .

Product Attributes and SKUs


product_attributes
attribute_id (Primary Key)
product_id (Foreign Key)
attribute_name (e.g., "color", "size")
attribute_value (e.g., "red", "XL")
skus
sku_id (Primary Key)
product_id (Foreign Key)
price

quantity

is_active

(Additional SKU-specific attributes can be added as needed)


An SKU (Stock Keeping Unit) represents a specific variation of a product, such as size or color,
with its own price and inventory [1] [3] .
Product Images
product_images
image_id (Primary Key)
product_id (Foreign Key)
image_url

is_main (boolean, for featured image)


sku_images (optional, for SKU-specific images)
image_id

sku_id (Foreign Key)


image_url

is_main

Wishlist
wishlists
wishlist_id (Primary Key)
user_id (Foreign Key)
product_id (Foreign Key)
created_at

Carts
carts
cart_id (Primary Key)
user_id (Foreign Key)
created_at

updated_at

cart_items
cart_item_id (Primary Key)
cart_id (Foreign Key)
sku_id (Foreign Key)
quantity

added_at
Orders
orders
order_id (Primary Key)
user_id (Foreign Key)
address_id (Foreign Key)
order_date

status (e.g., "pending", "shipped", "delivered")


total_amount

order_items
order_item_id (Primary Key)
order_id (Foreign Key)
sku_id (Foreign Key)
quantity

price_at_purchase

discount

Payments
payments
payment_id (Primary Key)
order_id (Foreign Key)
amount

payment_method

transaction_id

status

payment_date

Shipments
shipments
shipment_id (Primary Key)
order_id (Foreign Key)
carrier

tracking_number

shipped_date

delivered_date

status
Summary Table
Table Key Columns Relationships Purpose

users user_id - Customer accounts

addresses address_id, user_id users Shipping/billing addresses

categories category_id, parent_id - Product categorization

products product_id, category_id categories Product info

Product variations (color,


product_attributes attribute_id, product_id products
size, etc.)

products, Product variants with


skus sku_id, product_id
product_attributes price/inventory

product_images image_id, product_id products Product images

SKU-specific images
sku_images image_id, sku_id skus
(optional)

wishlist_id, user_id,
wishlists users, products Saved for later
product_id

carts cart_id, user_id users Shopping cart

cart_item_id, cart_id,
cart_items carts, skus Items in cart
sku_id

order_id, user_id,
orders users, addresses Customer orders
address_id

order_item_id, order_id,
order_items orders, skus Items in order
sku_id

payments payment_id, order_id orders Payment details

shipments shipment_id, order_id orders Shipment tracking

Additional Notes
Normalization: The schema is normalized up to the third normal form (3NF) to ensure data
integrity and consistency [2] [4] .
Scalability: For very large-scale systems like Amazon, consider using NoSQL databases
(e.g., DynamoDB, MongoDB) for high-velocity or unstructured data, and relational
databases for transactional data [5] [6] .
Extensibility: The schema can be extended with additional tables for reviews, ratings,
returns, vendors, and more as needed [3] .
This schema serves as a robust foundation for an Amazon-like e-commerce platform, supporting
user management, product catalog, shopping cart, order processing, payments, and
shipments [2] [3] .

1. https://dev.to/ezzdinatef/ecommerce-database-design-1ggc
2. https://vertabelo.com/blog/er-diagram-for-online-shop/
3. https://www.linkedin.com/pulse/designing-robust-database-schema-e-commerce-shirsh-sinha-7orsc
4. https://github.com/marymathews/amazon-database-design
5. https://www.codekarle.com/system-design/Amazon-system-design.html
6. https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/data-modeling-schemas.html

You might also like