← All schemas
Schema Library

E-commerce Database Schema Diagram

Every online store is the same 11 tables with different CSS. Customers have addresses and carts; carts hold cart items that reference products; products belong to categories and have images; orders snapshot cart items into order items and collect payments; reviews link customers to products. This is the complete e-commerce schema diagram that powers Shopify, WooCommerce, and most custom PostgreSQL storefronts.

Last updated: 2026-09-03

Tables
11
Core table
orders
Pattern
Shopify / WooCommerce
Mini Map

Tables in the E-commerce schema

ColumnTypeNullableKey
customers
iduuidNoPK
emailvarcharNo-
first_namevarcharYes-
last_namevarcharYes-
phonevarcharYes-
created_attimestamptzNo-
updated_attimestamptzYes-
addresses
iduuidNoPK
customer_iduuidNo-
labelvarcharYes-
line1varcharNo-
line2varcharYes-
cityvarcharNo-
statevarcharYes-
postal_codevarcharNo-
countryvarchar(2)No-
is_defaultboolNo-
categories
iduuidNoPK
namevarcharNo-
slugvarcharNo-
parent_iduuidYes-
descriptiontextYes-
created_attimestamptzNo-
products
iduuidNoPK
titlevarcharNo-
slugvarcharNo-
descriptiontextYes-
category_iduuidYes-
price_centsintegerNo-
currencyvarchar(3)No-
inventory_countintegerNo-
is_activeboolNo-
created_attimestamptzNo-
updated_attimestamptzYes-
product_images
iduuidNoPK
product_iduuidNo-
urltextNo-
alt_textvarcharYes-
positionintegerNo-
created_attimestamptzNo-
carts
iduuidNoPK
customer_iduuidYes-
statusvarcharNo-
created_attimestamptzNo-
updated_attimestamptzYes-
expires_attimestamptzYes-
cart_items
iduuidNoPK
cart_iduuidNo-
product_iduuidNo-
quantityintegerNo-
unit_price_centsintegerNo-
added_attimestamptzNo-
orders
iduuidNoPK
customer_iduuidNo-
statusvarcharNo-
total_centsintegerNo-
currencyvarchar(3)No-
shipping_address_iduuidYes-
billing_address_iduuidYes-
placed_attimestamptzNo-
paid_attimestamptzYes-
shipped_attimestamptzYes-
order_items
iduuidNoPK
order_iduuidNo-
product_iduuidNo-
quantityintegerNo-
unit_price_centsintegerNo-
total_centsintegerNo-
created_attimestamptzNo-
payments
iduuidNoPK
order_iduuidNo-
providervarcharNo-
provider_payment_idtextYes-
amount_centsintegerNo-
currencyvarchar(3)No-
statusvarcharNo-
created_attimestamptzNo-
reviews
iduuidNoPK
product_iduuidNo-
customer_iduuidNo-
ratingsmallintNo-
titlevarcharYes-
bodytextYes-
created_attimestamptzNo-

Frequently asked questions

What tables does an e-commerce database need?

A standard e-commerce schema needs customers, addresses, categories, products, product_images, carts, cart_items, orders, order_items, payments, and reviews — 11 tables covering catalog, cart, checkout, and post-purchase flows.

What is the difference between cart_items and order_items?

cart_items are mutable — quantities change until checkout. order_items are immutable snapshots copied from the cart at order time, preserving the price and product that was actually purchased even if the product later changes.

Visualize your own database

Paste your PostgreSQL connection string and get an interactive ER diagram of your own schema in under 10 seconds. No signup required.

Try it free →