A production-style SQL curriculum β from your first SELECT to analytics engineering, interview prep, and real business case studies.
Who It's For Β· Why Different Β· Roadmap Β· Structure Β· Quick Start Β· Docs Β· Contributing Β· FAQ
If you're an aspiring or practicing Data Analyst or Analytics Engineer who wants a structured path from SQL fundamentals to real business analytics β not another disconnected list of .sql files β this handbook is built for you.
Honest status: Modules 00β09 (Foundations β Date Functions) are complete and stable today. Modules 10β20, plus
datasets/,projects/,exercises/, andcheatsheets/, are actively being built module by module. Live status always lives inROADMAP.mdβ this README won't claim more than what's actually shipped.
| Typical SQL repo | SQL Engineering Handbook | |
|---|---|---|
| ποΈ Data | One generic sample table | Real-world-style datasets across HR, e-commerce, sales, finance, healthcare |
| π Context | Bare query, no explanation | Business problem stated before every solution |
| Rarely documented | Common mistakes called out per pattern | |
| π― Interview angle | Absent | Dedicated interview-prep module + question bank |
| π Progress | Static snapshot | Public roadmap, versioned via CHANGELOG.md |
| π€ Contribution | Solo repo | Structured community process via CONTRIBUTING.md |
|
Every completed module follows one format: business context β SQL solution β explanation β common mistakes β interview follow-ups β practice challenge. |
Practice is built around real-world-style datasets (HR, e-commerce, sales, finance, healthcare) instead of one toy table, so the SQL transfers directly to a job. |
|
|
Modules progress from syntax β analytical SQL (windows, CTEs) β engineering concerns (views, indexes, query optimization). |
|
Architecture, style guide, roadmap, and changelog are first-class files β not afterthoughts β so the repo stays maintainable as it grows. |
flowchart LR
subgraph Foundations
A[00 Sample Database] --> B[01 Fundamentals]
B --> C[02 Aggregations]
C --> D[03 Joins]
end
subgraph Core_SQL[Core SQL]
D --> E[04 CASE WHEN]
E --> F[05 Subqueries]
F --> G[06 CTEs]
end
subgraph Analytical_SQL[Analytical SQL]
G --> H[07 Window Functions]
H --> I[08 Window Business Cases]
I --> J[09 Date Functions]
end
subgraph Engineering_SQL[Engineering SQL]
J --> K[10-13 Strings, Nulls, Advanced Aggs, Set Ops]
K --> L[14-16 Views, Indexes, Query Optimization]
end
subgraph Career_Ready[Career Ready]
L --> M[17 Interview Questions]
M --> N[18 Business Case Studies]
N --> O[19 Projects]
O --> P[20 Cheatsheet]
end
Full module-by-module status
| # | Module | Status |
|---|---|---|
| 00 | Sample Database | β Complete |
| 01 | Fundamentals | β Complete |
| 02 | Aggregations | β Complete |
| 03 | Joins | β Complete |
| 04 | CASE WHEN | β Complete |
| 05 | Subqueries | β Complete |
| 06 | CTEs | β Complete |
| 07 | Window Functions | β Complete |
| 08 | Window Function Business Cases | β Complete |
| 09 | Date Functions | β Complete |
| 10 | String Functions | β Complete |
| 11 | NULL Handling & Data Cleaning | β οΈ Complete |
| 12 | Advanced Aggregations | β οΈ Complete |
| 13 | Set Operators | β οΈ Complete |
| 14 | Views | π In Progress |
| 15 | Indexes | π In Progress |
| 16 | Query Optimization | π In Progress |
| 17 | SQL Interview Questions | π In Progress |
| 18 | SQL Business Case Studies | π In Progress |
| 19 | SQL Projects | π In Progress |
| 20 | SQL Cheatsheet | π In Progress |
Legend: β Complete Β Β·Β π In Progress Β Β·Β π Planned
Live tracking always in ROADMAP.md.
SQL-Engineering-Handbook/
β
βββ README.md You are here
βββ ROADMAP.md Live module-by-module progress
βββ CHANGELOG.md Version history
βββ ARCHITECTURE.md Why the repo is organized this way
βββ STYLE_GUIDE.md Format every module/query follows
βββ CONTRIBUTING.md How to contribute
βββ CODE_OF_CONDUCT.md Community standards
βββ SECURITY.md How to report security concerns
βββ FAQ.md Common questions
βββ LICENSE MIT
β
βββ .github/ Issue/PR templates, CI workflows, CODEOWNERS
β βββ ISSUE_TEMPLATE/
β βββ workflows/
β βββ PULL_REQUEST_TEMPLATE.md
β βββ CODEOWNERS
β
βββ assets/ Banners, diagrams, screenshots, logos
β βββ banners/
β βββ diagrams/
β βββ screenshots/
β βββ logos/
β βββ gifs/
β
βββ datasets/ Real-world practice datasets
β βββ employee_management/
β βββ ecommerce/
β βββ sales/
β βββ finance/
β βββ healthcare/
β βββ nagpurlens/
β
βββ resources/ Curated external learning material
β βββ books.md
β βββ blogs.md
β βββ documentation.md
β βββ youtube.md
β βββ interview-resources.md
β
βββ cheatsheets/ Quick-reference syntax guides
β βββ joins/
β βββ ctes/
β βββ windows/
β βββ dates/
β βββ strings/
β βββ aggregation/
β
βββ exercises/ Practice problems by difficulty
β βββ beginner/
β βββ intermediate/
β βββ advanced/
β βββ interview/
β
βββ projects/ End-to-end portfolio projects
β βββ hr-analytics/
β βββ ecommerce/
β βββ pizza-sales/
β βββ olist/
β βββ nagpurlens/
β
βββ 00_SAMPLE_DATABASE/ β
Practice schema + seed data
βββ 01_FUNDAMENTALS/ β
SELECT, WHERE, ORDER BY, LIMIT
βββ 02_AGGREGATIONS/ β
GROUP BY, HAVING, aggregate functions
βββ 03_JOINS/ β
Inner, Left, Right, Full, Cross
βββ 04_CASE_WHEN/ β
Conditional logic & transforms
βββ 05_SUBQUERIES/ β
Scalar, inline, correlated
βββ 06_CTEs/ β
Common Table Expressions & recursion
βββ 07_WINDOW_FUNCTIONS/ β
ROW_NUMBER, RANK, LAG/LEAD
βββ 08_WINDOW_BUSINESS_CASES/ β
Applied window function scenarios
βββ 09_DATE_FUNCTIONS/ β
Date arithmetic, formatting, ranges
βββ 10_STRING_FUNCTIONS/ π In progress
βββ 11_NULL_HANDLING_AND_DATA_CLEANING/ π In progress
βββ 12_ADVANCED_AGGREGATIONS/ π In progress
βββ 13_SET_OPERATORS/ π In progress
βββ 14_VIEWS/ π In progress
βββ 15_INDEXES/ π In progress
βββ 16_QUERY_OPTIMIZATION/ π In progress
βββ 17_SQL_INTERVIEW_QUESTIONS/ π In progress
βββ 18_SQL_BUSINESS_CASE_STUDIES/ π In progress
βββ 19_SQL_PROJECTS/ π In progress
βββ 20_SQL_CHEATSHEET/ π In progress
Every numbered module is self-contained: read its own README, run its queries against the relevant dataset, then attempt the practice challenge at the end. See ARCHITECTURE.md for the reasoning behind this layout.
# 1. Clone the repository
git clone https://github.com/theammarngp-makes/SQL-Engineering-Handbook.git
cd SQL-Engineering-Handbook
# 2. Load a practice dataset (start with the core sample database)
mysql -u root -p < 00_SAMPLE_DATABASE/schema.sql
# 3. Start with Fundamentals, or jump to any completed module
cd 01_FUNDAMENTALSDatabase: MySQL 8.0+. Queries are ANSI-standard where possible, with MySQL-specific notes called out β most run on PostgreSQL with minor syntax changes.
π Sequential learner β go module by module
Work straight through 00_SAMPLE_DATABASE β 09_DATE_FUNCTIONS (currently complete), then continue into 10β20 as they release. No prior SQL knowledge assumed.
π― Interview sprint β targeted prep
Once live, 17_SQL_INTERVIEW_QUESTIONS/ and exercises/interview/ will be the fastest path. Until then, 07_WINDOW_FUNCTIONS/ and 08_WINDOW_BUSINESS_CASES/ cover the most commonly tested interview topic.
π Desk reference β search when you need a pattern
Bookmark the repo and jump directly to the numbered module matching the syntax you need on the job.
Salary ranking with window functions (from 07_WINDOW_FUNCTIONS/)
SELECT
emp_id,
emp_name,
salary,
RANK() OVER (ORDER BY salary DESC) AS salary_rank,
LAG(salary) OVER (ORDER BY salary DESC) AS prev_salary
FROM employees;Every completed module follows this format: business context β SQL solution β explanation β common mistakes β interview follow-ups β practice challenge.
| Doc | Purpose |
|---|---|
ROADMAP.md |
Live module-by-module progress and what's next |
ARCHITECTURE.md |
How the repo, datasets, and modules are structured and why |
STYLE_GUIDE.md |
Format every module and query follows |
CHANGELOG.md |
Version history of the handbook |
FAQ.md |
Common questions about setup and usage |
CONTRIBUTING.md |
How to contribute |
SECURITY.md |
How to report security concerns |
CODE_OF_CONDUCT.md |
Community standards |
GitHub features: Issues for bugs and requests Β· Discussions for questions about a specific query or module.
This project is being built module by module, and contributions are genuinely welcome β new queries, dataset additions, exercises, corrections, or documentation improvements.
- Fork the repository
- Create a feature branch
- Follow the format in
STYLE_GUIDE.md - Open a pull request using the template in
.github/PULL_REQUEST_TEMPLATE.md
Full standards live in CONTRIBUTING.md. Please review the CODE_OF_CONDUCT.md before participating.
- π Found a bug? Open an issue
- π¬ Question about a query? Start a Discussion
- π Security concern? See
SECURITY.md
Is this finished?
No β and it says so on purpose. Modules 00β09 are complete and stable. 10β20, plus datasets, exercises, projects, and cheatsheets, are actively being built. Check ROADMAP.md for live status.
Do I need MySQL specifically? Queries are ANSI-standard where possible, with MySQL-specific notes called out. Most run on PostgreSQL with minor syntax changes.
Is this beginner-friendly?
Yes β start at 01_FUNDAMENTALS/. It assumes no prior SQL knowledge.
Can I use this for interview prep only?
That's the goal of 17_SQL_INTERVIEW_QUESTIONS/ and exercises/interview/ once live; until then, 08_WINDOW_BUSINESS_CASES/ is the closest match.
More in FAQ.md.
Licensed under the MIT License. See LICENSE for details.
Mohammad Ammar Aspiring Data Analyst Β· SQL Enthusiast Β· Data Storyteller
This handbook is built in public and updated regularly. If it's useful to you, starring the repo helps more learners find it β and following along tracks its progress from here to a full 21-module release.
