8. Advanced SQL Features
This module introduces features that unlock advanced reporting and complex transformations without moving data into application code.
Decision Guide
| Need | Feature | Why |
|---|---|---|
| Break a query into readable steps | CTE (WITH) | Improves maintainability |
| Hierarchies / graphs | Recursive CTE | SQL-native recursion |
| Ranking, running totals, deltas | Window functions | Keep detail rows while computing analytics |
| Flexible attributes | jsonb | Queryable semi-structured data with indexes |
| Session-scoped intermediate results | Temporary tables | Useful for ETL and complex workflows |
Lessons
- Common Table Expressions (CTEs)
- Recursive CTE Patterns
- Temporary Tables
- Window Functions
- JSONB Querying and Indexing
What's Next
- Continue to 9. Database Management