A beginner SQL project simulating an online store's database to manage customers, products, orders, and analyze sales data.
This project creates a relational database for an e-commerce platform, tracking customer purchases and providing insights like total revenue, top products, and customer spending habits.
- SQL (Tested with SQLite, compatible with MySQL/PostgreSQL)
- Create the Database: Run
schema.sql
to create the tables. - Populate Data: Run
data.sql
to insert sample data (10 customers, 10 products, 15 orders). - Run Queries: Explore
queries.sql
for analysis examples.
- Total Revenue (Jan-Feb 2025): $5839.80
- Top Product: "Laptop" (3 units sold)
- Top Customer: Henry Moore ($1599.98 spent)
- Best Category: Electronics ($4799.88 revenue)
schema.sql
: Table creation scripts.data.sql
: Sample data for testing.queries.sql
: Queries for sales analysis.
- Table design with primary/foreign keys
- JOINs, aggregation (SUM, COUNT), and grouping
- Filtering and sorting data
Feel free to fork this repo and expand it with more data or queries!