Track 0/9 (0%)
Module 09 · Capstone~18 min · 2 worked queries
Full Analytical Pipelines End to End
Trace every clause in symphony — CTEs, joins, row filters, grouped buckets, window ranks, projection, sorting, and cutoff limits.
Complex analytical SQL is predictable once read along the execution graph: table scan -> join -> filter -> fold -> having -> window -> project -> sort -> limit.Module 09 · Capstone · Reading Room
Mental Model
- 01.
Each stage narrows, widens, folds, or annotates a tabular relation before handing ownership to the next clause.
- 02.
Row lineage traces backward from any output tuple through aggregations, joins, and filters to the original storage rows.
Interactive Module Lab · Full Pipeline
48. Everything together — sqlWITH paid AS (SELECT user_id, SUM(amount) AS spentFROM ordersWHERE status = 'Completed'GROUP BY user_id)SELECT u.name, d.name AS department, p.spent,RANK() OVER (ORDER BY p.spent DESC) AS spend_rankFROM users uJOIN paid p ON p.user_id = u.idJOIN departments d ON d.id = u.department_idORDER BY spend_rankLIMIT 5;
Execution Stages7 steps
Stage 01 · FROM
10 in → 10 outSOURCE: USERS
Scanned 10 rows from table 'users'.
| # | id | name | department_id | role | salary | state |
|---|---|---|---|---|---|---|
| 1 | 1 | Alice Smith | 1 | Software Engineer | 95,000 | keep |
| 2 | 2 | Bob Jones | 2 | Product Manager | 110,000 | keep |
| 3 | 3 | Charlie Lee | 1 | Software Engineer | 88,000 | keep |
| 4 | 4 | Diana Prince | 3 | UX Designer | 76,000 | keep |
| 5 | 5 | Evan Wright | 2 | Data Analyst | 82,000 | keep |
| 6 | 6 | Fiona Gallagher | 1 | Tech Lead | 135,000 | keep |
| 7 | 7 | George Clark | NULL | Intern | 42,000 | keep |
| 8 | 8 | Hannah Abbott | 2 | Scrum Master | 89,000 | keep |
Inspect each evaluated clause in 48. Everything together or animate every row moving between stages in Studio.Open 48. Everything together in Studio →