You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Star0 (0)You must be signed in to star a repository
About
Advanced SQL project demonstrating JOINs, subqueries, window functions, string and date functions, and CASE statements for data querying and transformation.
A comprehensive SQL project demonstrating advanced querying techniques — JOINs, Subqueries, Window Functions, String Functions, Date Functions, and CASE statements — across a real-world Customers, Orders and Employees database.
📌 Project Overview
This project builds and queries a relational database with 3 tables and covers 17 advanced SQL operations — going beyond basic CRUD to explore data transformation, ranking, running totals, conditional logic, and string manipulation used in real Data Analyst workflows.
Database data_transformer will be created with all tables and queries!
📸 Sample Queries & Output
-- Running Total of OrdersSELECT OrderID, Total_amount,
SUM(Total_amount) OVER (ORDER BY OrderID) AS Running_total
FROM orders;
-- Output: 500.25 → 625.30 → 1402.40 → 1522.51 → 2172.51-- Salary Category using CASESELECT firstname, salary,
CASE
WHEN salary >=75000 THEN 'HIGH'
WHEN salary BETWEEN 60000AND75000 THEN 'MEDIUM'
ELSE 'LOW'
END AS Salary_Category FROM employees;
-- Discount based on Order Amount-- >= 1000 → 10% OFF | >= 500 → 5% OFF | else → No Discount
💡 What I Learned
Writing all 4 types of JOINs — INNER, LEFT, RIGHT, FULL (UNION)
Using Subqueries to filter data based on aggregate values
Applying Window Functions — RANK() and SUM() OVER() for running totals
Transforming strings using CONCAT(), REPLACE(), UPPER(), LOWER(), TRIM()
Formatting and calculating dates using DATEDIFF(), DATE_FORMAT(), YEAR(), MONTH()
Implementing conditional logic using CASE WHEN statements
About
Advanced SQL project demonstrating JOINs, subqueries, window functions, string and date functions, and CASE statements for data querying and transformation.