Welcome! You've discovered more than just a collection of SQL notes – this is a meticulously crafted, complete learning system I built from the ground up, designed to take you from foundational concepts to advanced PostgreSQL mastery.
Tired of surface-level tutorials that leave you with more questions than answers? Me too. That's why I didn't just solve exercises; I created the entire curriculum – from in-depth theoretical lectures to practical, hands-on exercises for every concept. My goal is to foster deep understanding, not just rote memorization.
This repository is a testament to a passion for SQL and a commitment to structured, comprehensive learning

- 🌟 Authored, Not Just Aggregated: Every PDF lecture and accompanying exercise set was developed by me, ensuring a cohesive and progressive learning experience.
- 🧠 Beyond Syntax – True Understanding: We dive deep into the "why" behind SQL concepts, not just the "how."
- 🛠️ Practical, Hands-On Learning: Theory is immediately reinforced with custom-designed exercises to solidify your skills.
- 🐘 PostgreSQL Focused but Universally Applicable (Oracle SQL, Server SQL, MySQL): While leveraging the power and advanced features of PostgreSQL, the core concepts learned are transferable to any SQL dialect.
- 📈 From Novice to Pro: A clear path from
BASICSQL fundamentals, throughINTERMEDIATEtechniques, toADVANCEDquery wizardry andCOMPLEMENTARYdeep-dives. - 📊 Real-World Application: Try to visualize data insights using Metabase (Open Source with generous free tiers), connecting SQL power to business intelligence.
Before to start this, be sure to take these tutorials Basic SQL and Intermediate SQL from DataLemur SQL Tutorial. This course is sequentially structured to build your knowledge step-by-step. Each module contains detailed PDF lectures and dedicated exercises.
-
📜 BASIC SQL
- Conditionals:
WHERE - Conditionals:
ORDER BY
- Conditionals:
-
📜 INTERMEDIATE SQL
- Aggregators:
GROUP BY,HAVING - Conditionals:
DISTINCT - Arithmetic & Math Functions
- Date Functions
- Casters
- Null Space
- Cases & Joins
- Aggregators:
-
📜 Complementary SQL (Bridging Basic & Intermediate to Advanced)
- Advanced
WHEREConditions (Subqueries:IN,EXISTS,ANY,ALL,IS DISTINCT FROM) - Advanced
ORDER BY(NULLS FIRST/LAST, Multi-column) - Advanced Joins (
CROSS JOIN,NATURAL JOIN,SELF JOIN,USINGclause) - Advanced Aggregators (
COUNT(DISTINCT),FILTERclause) - Advanced Date Functions (Date arithmetic,
OVERLAPSoperator) - Advanced Cases (Searched
CASE,CASEinORDER BY,CASEinGROUP BY) - Advanced Null Space (
NULLIF, Handling in aggregations/sorting) - More Arithmetic, Math, and String Functions
- Set Operations (
UNION,INTERSECT,EXCEPT) - Subqueries (Scalar, Correlated, in
FROMclause, inSELECTclause)
- Advanced
-
📜 ADVANCED SQL (PostgreSQL Focused)
- Advanced Query Techniques (
FETCH,OFFSET,LATERALJoins) - Common Table Expressions (CTEs) (Basic, Nested, Recursive)
- Data Transformation & Aggregation
- Advanced Aggregate Functions (
STRING_AGG,ARRAY_AGG,JSON_AGG, etc.) - Advanced Grouping Operations (
GROUPING SETS,CUBE,ROLLUP) - Set Returning Functions (
generate_series,unnest) - JSON and Array Functions (Deep Dive)
- Advanced Aggregate Functions (
- Analytical Constructs (Window Functions:
OVER(),PARTITION BY,RANK,LEAD,LAG, etc.) - Query Optimization and Performance (Indexing,
EXPLAINPlans, Optimizing Window/Aggregates)
- Advanced Query Techniques (
By progressing through this course, you'll gain the ability to:
- Write SQL queries from simple to highly complex with confidence.
- Understand and utilize a vast array of SQL functions: Date, String, Math, JSON, Array.
- Master all types of JOINs, including advanced techniques like
LATERALandSELFjoins. - Perform sophisticated data aggregation and analysis using
GROUP BY,HAVING,ROLLUP,CUBE, andGROUPING SETS. - Leverage the power of Window Functions for intricate analytical tasks.
- Write efficient queries by understanding Common Table Expressions (CTEs), subqueries, and set operations.
- Optimize PostgreSQL query performance through indexing strategies and
EXPLAINplan analysis. - Confidently tackle complex data manipulation and transformation tasks directly within the database.
- Primary Database: PostgreSQL (all examples and advanced features are tailored for it)
- Lecture Format: PDFs (for easy reading, annotation, and offline access)
- Business Intelligence Frontend (Demonstration): Metabase (showcasing how SQL queries fuel real-world dashboards)
This repository is born from a desire to provide a clear, deep, and practical path to SQL mastery. It's the kind of resource I wished I had when I was learning.
While the SQL curriculum is comprehensive, the journey doesn't end here! Future explorations stemming from this foundation will delve into:
- Server-Side Programming with SQL: Integrating SQL with application logic.
- Database Administration & DevOps: Understanding the infrastructure that powers our queries.
My hope is that this becomes a valuable resource for anyone serious about learning SQL and PostgreSQL.
Whether you're starting your SQL adventure, looking to level up your PostgreSQL skills, or even seeking a dedicated individual for SQL-related projects, I hope you find immense value here.
- ⭐ Star this repository if you find it helpful!
- 🔗 Fork it and create your own learning path or contribute.
- 🤔 Open an Issue for questions, suggestions, or to report any errors you might find in the lectures or exercises. Constructive feedback is always welcome!
- 💬 Let's make this a space for learning and growth in the SQL community.
Thank you for visiting, and happy querying!