Code24Lab
Databases & SQL Advanced

SQL Server T-SQL Mastery: Window Functions, Indexes & Execution Plans

Master window functions, APPLY and PIVOT, then go under the hood of SQL Server: clustered and nonclustered indexes, SARGable predicates, execution plans, statistics, parameter sniffing, isolation levels, locking and safe dynamic SQL, 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

SQL Server T-SQL Mastery takes you from writing correct queries to understanding how SQL Server runs them. In 21 hands-on labs you compute exactly what window functions return, from ROW_NUMBER, RANK and NTILE to running totals, LAG and the LAST_VALUE frame trap, and solve gaps-and-islands, top-N and deduplication tasks with CTEs, APPLY and PIVOT. Then you go under the hood: size B-tree indexes, compare key lookups with covering indexes, spot non-SARGable predicates, read execution plans and histograms, measure parameter sniffing, replay isolation levels and deadlocks, and write dynamic SQL safely. Every answer is checked instantly, and the first lesson is free.

Lessons

  1. ROW_NUMBER, RANK and DENSE_RANKLabFree
  2. Running Totals: ROWS vs the Default RANGE FrameLab Locked
  3. Moving Averages with Sliding FramesLab Locked
  4. LAG and LEAD: Comparing with Neighbour RowsLab Locked
  5. FIRST_VALUE, LAST_VALUE and the Frame TrapLab Locked
  6. NTILE, PERCENT_RANK and CUME_DISTLab Locked
  7. Top-N per Group and Deduplication with a CTELab Locked
  8. Gaps and Islands: Finding StreaksLab Locked
  9. CROSS APPLY and OUTER APPLYLab Locked
  10. PIVOT, UNPIVOT and Conditional AggregationLab Locked
  11. Clustered Indexes: Pages, Levels and SeeksLab Locked
  12. Nonclustered Indexes, Key Lookups and CoveringLab Locked
  13. SARGable Predicates: Seek or Scan?Lab Locked
  14. Reading Execution Plans: Cost and EstimatesLab Locked
  15. Join Operators: Nested Loops, Merge and HashLab Locked
  16. Statistics and Histograms: How Estimates Are MadeLab Locked
  17. Parameter Sniffing and Plan ReuseLab Locked
  18. Isolation Levels: Dirty Reads and PhantomsLab Locked
  19. Locks, Blocking, Escalation and DeadlocksLab Locked
  20. Dynamic SQL Done Safely: sp_executesql and QUOTENAMELab Locked
  21. Final Project: A Window-Function Sales ReportLab Locked