AI LiteracyintermediateVideo + quiz

Advanced SQL for Analytics: Window Functions, CTEs and Fast Queries

Go beyond basic SQL to the queries analytical reporting really needs.

22 lessons · 1.2 hours
Watch the first lesson freeWelcome: Peregrine Health and the questions behind the reports · 4 min

Sign in to watch one lesson from this course free.

What you will be able to do

Use window frames, ranking and LAG to answer running total, top N and period questionsStructure long queries with CTEs, recursion and gaps and islands patternsBuild cohort, funnel and subtotal reports in a single queryRead EXPLAIN ANALYZE and choose the index or rewrite that makes a query fast

Skills you will gain

  • Window frames and moving averages
  • Ranking and top N per group
  • CTEs and recursive queries
  • Gaps and islands
  • Cohort retention and funnels
  • ROLLUP and GROUPING SETS
  • Reading EXPLAIN ANALYZE
  • PostgreSQL index design

About this course

Go beyond basic SQL to the queries analytical reporting really needs. You frame running totals and moving averages, rank inside every group, compare periods with LAG, write long queries as named CTEs, walk hierarchies with recursion, find streaks with gaps and islands, and build cohort, funnel and subtotal reports in one statement. Then you read EXPLAIN ANALYZE, choose composite, covering and partial indexes, rewrite filters the planner can use and decide when a materialized view is the better answer. Runs free on PostgreSQL 17 or later with invented clinic data.

AI Literacy

Curriculum

7 modules · 22 lessons · 1.2h

Requirements

SELECT, WHERE and ORDER BY
Joins and GROUP BY with count and sum
PostgreSQL 17 or later, free
psql, its command line client
Say what one row of the result is
Prove every number a second way

What you walk away with

A Yallo AI Academy certificate of completion, issued when every lesson is complete and the final assessment is passed at 70% or aboveA public verification page, so a stranger can check the certificate without asking you for a filePDF download, and a one-click share to your LinkedIn profile

Yallo AI Academy certifies completion of

Advanced SQL for Analytics: Window Functions, CTEs and Fast Queries