advancedTop 15 Database Design Questions

Design a database schema for an e-commerce platform (customers, products, orders, categories, reviews).

customers(id, email UNIQUE, name, created_at) — email is natural unique key categories(id, name, parent_id NULLABLE FK self-referential for hierarchy) products(id, name, price DECIMAL, sku UNIQUE, category_id FK, created_at) orders(id, customer_id FK, status, total_amount, created_at) — snapshot total at order time order_items(order_id FK, product_id FK, quantity, unit_price, PRIMARY KEY(order_id,

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to Design a scalable multi-tenant SaaS database for 50,000 tenants.← Back to all SQL questions