SQL + Pyhton project using CTEs, window functions, and aggregatied queries on the Northwind database.
SQLite (Northwind) Tables: Customers, Orders, OrderDetails, Products, Employees, Shippers, Suppliers, Categories.
Each query is a .sql file. There questions/analysis below are implemented.
- Customer revenue ranking - DENSE_RANK() by total spend
- Daily running total - SUM() OVER(ORDER BY OrderDate)
- Month on month revenue change - LAG() with difference
- Top 3 products per category - ROW_NUMBER() PARTITION BY
- Employee sales vs company average - AVG() OVER()
- Employee sales rank - RANK()
- Customer order frequency rank - DENSE_RANK()
- First and last order per customer - MIN/MAX OVER(PARTITION BY)
- Product revenue rank within category - RANK() OVER(PARTITION BY)
- Unordered products - LEFT JOIN with IS NULL
- SQLite
- Python (pandas, sqlalchemy)
- SQL (window functions, CTEs, joins)