SQL Tutorials

🗃️

SQL

SQL for Data Engineers

Joins, window functions, CTEs, stored procedures, indexes, transactions, MERGE, and every SQL concept you need.

15 in-depth tutorials

01SQL Execution Order & WHERE

How SQL executes: FROM, WHERE, GROUP BY, HAVING, SELECT, ORDER BY — the real execution order.

02GROUP BY, HAVING & CASE WHEN

Master SQL aggregations with the post office analogy. GROUP BY rules, COUNT/SUM/AVG/MIN/MAX with NULL behavior, WHERE vs HAVING, CASE WHEN in SELECT/WHERE/ORDER BY/aggregations (pivot pattern), COALESCE, NULLIF…

03Subqueries & Performance

Master all subquery types with the research analogy. WHERE/FROM/SELECT subqueries, correlated subqueries with step-by-step row execution, EXISTS and NOT EXISTS, the same question solved five ways (JOIN, IN, EXISTS…

04SQL Functions

The complete SQL function reference for data engineers. 50+ functions organized by category: string (TRIM, CONCAT, REPLACE, SUBSTRING, STUFF, STRING_AGG), date (DATEDIFF, DATEADD, DATEPART, EOMONTH, FORMAT), numeric…

05SQL Joins

Master every SQL join type with visual diagrams and real examples. Covers INNER, LEFT, RIGHT, FULL OUTER, CROSS, and SELF joins, plus ON vs WHERE, CTEs with joins, performance tips, and interview questions.

06Window Functions

Master SQL window functions with real examples. Covers ROW_NUMBER, RANK, DENSE_RANK, NTILE, LAG, LEAD, running totals, moving averages, frame clauses, and the most common interview questions.

07CTEs & Subqueries

Master SQL CTEs and subqueries. Learn when to use each, how to chain multiple CTEs, recursive CTEs for hierarchies, deduplication patterns, and real-world data engineering examples.

08DDL, DML, and Constraints

The complete DDL, DML, and constraints guide. CREATE TABLE with all data types, every constraint explained (PK, FK, UNIQUE, CHECK, DEFAULT, NOT NULL, composite keys), CASCADE options, ALTER TABLE, DROP vs TRUNCATE vs…

09Indexes and Execution Plans

Master SQL performance with the book index analogy. Table scan vs index seek, clustered vs non-clustered indexes, composite indexes with leftmost prefix rule, covering indexes with INCLUDE, reading execution plans…

10Views, Temp Tables & Variables

Views, temp tables, table variables, and CTEs compared: scope, persistence, and performance.

11Stored Procedures & Triggers

Automate SQL with stored procedures, functions, and triggers. Procedures with input/output parameters, TRY/CATCH error handling, our pipeline logging procedure. Scalar functions and table-valued functions with use cases.

12Normalization & Star Schema

Database design from both sides. Normalization: 1NF (atomic values), 2NF (no partial dependencies), 3NF (no transitive dependencies) with real examples.

13UNION, PIVOT & Dynamic SQL

Complete your SQL toolkit. UNION vs UNION ALL vs INTERSECT vs EXCEPT with playlist analogy, SET operations rules, four real-world patterns (multi-source combine, missing records, reconciliation, categorized union).

14Transactions & ACID

Master SQL transactions with six real-world scenarios. ACID properties explained with ATM, chess, fitting room, and notary analogies.

15SQL Interview Practice (20 Qs)

20 real SQL interview problems with step-by-step thinking process and solutions.

Scroll to Top