Code24Lab
Databases & SQL Advanced

SQL Mastery: Window Functions, Indexing & Query Optimisation

Rank, compare and accumulate rows with window functions, walk hierarchies with recursive CTEs, and estimate index, scan and join costs like a query planner, with every answer checked as you go.

21 lessons 21 labs Certificate

  • One-time payment
  • Instant access right after payment
  • Secure checkout with Stripe

About this course

Go beyond GROUP BY. In 21 interactive labs you read real SQL and work out exactly what it returns: leaderboards with ROW_NUMBER, RANK and DENSE_RANK, top-N per group, LAG and LEAD growth, running totals, moving averages and the ROWS vs RANGE frame trap, NTILE and percentiles, gaps and islands, and recursive CTEs for series and hierarchies. Then you think like a query planner: estimate selectivity, B-tree height, index versus full scan, composite index prefixes, sargable predicates, nested loop versus hash join, normalisation and isolation levels. Every answer is checked instantly, and a final exam earns your certificate.

Lessons

  1. ROW_NUMBER(): Numbering Rows Without Losing ThemLabFree
  2. PARTITION BY: Top-N per GroupLab Locked
  3. RANK, DENSE_RANK and ROW_NUMBER on TiesLab Locked
  4. LAG and LEAD: Comparing with the Previous RowLab Locked
  5. Running Totals with SUM() OVERLab Locked
  6. Window Frames: Moving Averages with ROWS BETWEENLab Locked
  7. ROWS vs. RANGE: The Default Frame TrapLab Locked
  8. Partition Totals and Shares Without GROUP BYLab Locked
  9. NTILE, PERCENT_RANK and CUME_DISTLab Locked
  10. FIRST_VALUE, LAST_VALUE and the Frame TrapLab Locked
  11. Gaps and Islands: Finding StreaksLab Locked
  12. Recursive CTEs: Generating a SeriesLab Locked
  13. Recursive CTEs: Walking a HierarchyLab Locked
  14. Index Selectivity and Optimizer StatisticsLab Locked
  15. B-tree Height and the Index vs. Scan DecisionLab Locked
  16. Composite Indexes and the Leftmost-Prefix RuleLab Locked
  17. Sargable Predicates and Date RangesLab Locked
  18. Join Algorithms: Nested Loop vs. Hash JoinLab Locked
  19. Normalisation: Redundancy, Anomalies and SizeLab Locked
  20. Transactions, Lost Updates and Isolation LevelsLab Locked
  21. Final Project: A Regional Revenue ReportLab Locked