SQL for Analytics: From Queries to Window Functions

SQL for Analytics: From Queries to Window Functions

SQL for Analytics: From Queries to Window Functions is a structured track of 14 lessons that build a complete, interview-ready understanding of the topic. Work through them in order, then use the quiz and flashcards in each lesson to revise.

What this course covers

  • Relational Databases, Keys & Reading an Entity Relationship Diagram - Tables, primary and foreign keys, relationships, and reading a schema diagram fast.
  • Normalisation & Denormalisation: What Each One Costs You - The normal forms in plain terms, and why analytics deliberately denormalises.
  • Query Execution Order and Why It Explains Most Errors - Why the database runs FROM before SELECT, and which beginner errors that explains.
  • Filtering Precisely: SELECT, WHERE, IN, LIKE & BETWEEN - Getting exactly the rows you meant, including the operators that quietly drop rows.
  • Aggregation & Grouping, Including HAVING versus WHERE - Aggregates, grouping sets, and the HAVING-versus-WHERE question interviewers ask.
  • Joins in Depth: Inner, Left, Full, Cross & Self Joins - Every join type with a worked row-level example of what it returns.
  • Join Fan-Out & Duplicate Rows: The Silent Wrong Answer - How a one-to-many join inflates totals, and how to detect it before you report.
  • Handling Nulls Correctly - Why null breaks comparisons, aggregates and joins, and the functions that tame it.
  • Subqueries, Common Table Expressions & Readable SQL - Restructuring nested logic into readable steps a reviewer can follow.
  • Window Functions: Ranking, Running Totals, Lag & Lead - The functions that decide strong SQL rounds, each with a business use case.
  • Date, Time & Cohort Queries That Interviews Reuse - Month-on-month change, rolling windows and first-purchase cohorts in SQL.
  • Query Performance: Indexes, Scans & Writing Efficient SQL - Why a query is slow, how to read a plan, and the rewrites that actually help.
  • Ten SQL Patterns That Cover Most Interview Questions - Ten reusable query shapes, from second-highest value to gap-and-island problems.
  • Case Study: Answering a Business Question End to End in SQL - One vague request turned into a validated query and a written answer.