Project: E-commerce Database

15 / 30

Project: E-commerce Database

## Project: E-commerce Database

Design a PostgreSQL schema for an online store. Your schema should support customers, products, orders, and order items, and demonstrate sensible relationships, constraints, and indexing.

Use the sections below to document your design. Include `CREATE TABLE` statements (or clear descriptions), explain your primary and foreign keys, and describe at least three queries the database would support.

Requirements & Entities

Describe the e-commerce system you are designing. What are the core entities (e.g. customers, products, orders, order_items, categories)? What does each entity represent, and what are the key attributes for each?

0 / 120 characters(120 more required)

Schema Design

Write the CREATE TABLE statements (or describe them) for your schema. Define column names, data types, PRIMARY KEYs, FOREIGN KEYs, and any NOT NULL or DEFAULT constraints. Explain why you chose those types and constraints.

0 / 200 characters(200 more required)

Relationships & Constraints

Explain the relationships between your tables. How do you enforce referential integrity and business rules? Where did you use UNIQUE, CHECK, or NOT NULL constraints? How do you handle deleting a customer or product that has related orders or order items?

0 / 150 characters(150 more required)

Indexes & Query Performance

List the indexes you would add and explain why. Which queries do they speed up? Mention any composite or partial indexes where appropriate.

0 / 120 characters(120 more required)

Sample Queries & Seed Data

Write a few representative queries for your schema: a top-level dashboard query (e.g. recent orders with customer info), an aggregation (e.g. revenue by month), and a write query (insert an order with items). Also describe a small seed data script or migration strategy.

0 / 150 characters(150 more required)

Progress

0of 5 sections

Sections