Skip to main content
dbSyntax
Home CoursePracticeReferenceModelingInterview Prep
Start Here
  • What is a database?
  • What is SQL?
  • SQL syntax
  • SQL datatypes
  • How to run queries (tooling)
  • How to read tables/ERDs
SQL Foundations
  • SELECT / FROM
  • ORDER BY
  • LIMIT / OFFSET
  • DISTINCT
  • Aliases
Filtering
  • WHERE
  • AND / OR / NOT
  • IN / BETWEEN
  • LIKE
  • NULL (IS NULL, COALESCE)
Aggregation
  • COUNT / SUM / AVG / MIN / MAX
  • GROUP BY
  • HAVING
  • CASE & Conditional Aggregation
Joins
  • Joins Intro
  • INNER JOIN
  • LEFT JOIN
  • RIGHT JOIN
  • FULL OUTER JOIN
  • CROSS JOIN
  • Self Join
  • Join Debugging: Duplicates & Missing Rows
  • UNION vs UNION ALL
Subqueries & CTEs
  • Subqueries (IN / EXISTS)
  • Correlated Subqueries
  • WITH (CTEs)
Window Functions
  • OVER / PARTITION BY / ORDER BY
  • ROW_NUMBER / RANK / DENSE_RANK
  • LAG / LEAD
  • Moving Averages & Running Totals
  • QUALIFY
Data Cleaning
  • String Cleanup
  • Date Parsing
  • Deduping
Analytics Patterns
  • Top-N Per Group
  • Cohorts & Retention
  • Funnels
  • Rolling Metrics & Period-over-Period
Performance Modeling
  • Index Intuition
  • Normal Forms
  • Reading Explain Plans
Capstone
  • Capstone Part 1: KPI Baseline
  • Capstone Part 2: Cohorts & Retention
  • Capstone Part 3: Segments & Recommendation
Home / Course / Analytics Patterns

Analytics Patterns

Learn SQL analytics patterns with practical examples and guided drills on dbSyntax.

Start with Top-N Per Group

Top-N Per Group

Intermediate

"Top 3 products per category." "Highest-spending customer per region." "Latest order per user." These all fit the same shape: rank within a ...

Cohorts & Retention

Intermediate

A cohort is a group of users who share a starting event, such as "everyone who signed up in March 2024". Retention asks: of that group, how ...

Funnels

Intermediate

A funnel measures how many users complete each step of an ordered sequence: view → add_to_cart → checkout → purchase. The drop-off between s...

Rolling Metrics & Period-over-Period

Intermediate

Executives don't ask "what was revenue on Tuesday?" They ask "how's revenue trending, and is it up or down vs last week?" The answer needs t...

dbSyntax Write and Run SQL in Your Browser
CoursePracticeReferenceModelingInterview PrepPrivacyTerms
© 2026 dbSyntax.