Objective:
- Use SQL queries to extract and analyze data from an Ecommerce database.
- Files in this Repository
- sql_ecommerce4.sql - Contains database schema, sample data inserts, and SQL queries.
- screenshots - Folder containing screenshots of query outputs.
Tools Used:
MySQL / PostgreSQL / SQLite (choose one depending on your setup)
Dataset Schema:
The database simulates an Ecommerce system with the following tables:
- Customers (customer_id, name, email, city, country)
- Products (product_id, product_name, category, price)
- Orders (order_id, customer_id, order_date, status)
- Order_Details (order_detail_id, order_id, product_id, quantity)
Steps to Run:
- Clone this repository:
- git clone
- cd
Open your SQL client (MySQL Workbench, pgAdmin, or SQLite Browser).
Import and run the SQL script:
SOURCE sql_ecommerce4.sql;
Verify tables and data:
SHOW TABLES;
SELECT * FROM Customers;
Queries Implemented
The SQL file includes:
SELECT, WHERE, ORDER BY, GROUP BY
INNER JOIN, LEFT JOIN, RIGHT JOIN
Subqueries
Aggregate functions (SUM, AVG)
Creating Views (Customer_Sales)
Index optimization