8 episodes, about 59 min 1 view across the series

Topics: Software and data foundations

SQL Interview Refresher

Created by Abhyuday DesaiUpdated , episode 8

A refresher on the SQL that data science and machine learning interviews ask for: aggregations, joins, NULL, subqueries, CTEs, window functions, and the question patterns built on them.

Start with episode 1

About this series

Eight short videos for engineers and data scientists who know SQL but have not written it daily, and have an interview coming up. This is not a course that teaches SQL from the start. Each video takes one topic that screening and technical interviews keep returning to, works it on a small fixed table that stays on screen, and names the trap the question is usually testing for: the fan-out that inflates a SUM, the filter that silently drops NULL rows, the NOT IN that returns nothing, the tie that ROW_NUMBER and RANK handle differently.

The first videos cover the clauses most questions are built on: aggregation with GROUP BY and HAVING, how joins match rows and which rows survive, and what NULL does to comparisons, counts and joins. The next three are about structuring an answer: the four subquery forms, CTEs for a multi-step query you can read under time pressure, and window functions for ranking, latest-per-group and running totals. The last two are about the prompts themselves: the four families most SQL interview questions come from, the words in a prompt that tell you which one you are looking at, and a worked template for each, closing on a one-card cheat sheet for all four.

Every query is standard, PostgreSQL-flavored SQL.

Part oneThe clauses most questions are built on

  1. 01

    SQL Aggregations

    Turn many order rows into one number per customer: COUNT, SUM, AVG, MIN and MAX, GROUP BY and HAVING, and conditional aggregation with CASE.

    7:41 1 view Published
    Watch
  2. 02

    SQL Joins

    How joins match rows and which rows survive: candidate pairs and the ON predicate, the preservation rule of each join type, fan-out, ON versus WHERE, and self-joins.

    9:52 0 views Published
    Watch
  3. 03

    SQL NULL Semantics

    Why a filter that looks right returns nothing: NULL as unknown, three-valued logic, IS NULL and COALESCE, NULL in counts, joins and the NOT IN trap.

    7:38 0 views Published
    Watch

Part twoStructuring an answer

  1. 04

    SQL Subqueries

    A query inside a query, and when to use each form: scalar, IN, EXISTS and correlated subqueries, the NOT IN plus NULL trap, and subquery versus JOIN versus CTE.

    8:27 0 views Published
    Watch
  2. 05

    SQL CTEs

    Write long queries you can actually read: the WITH clause, CTE versus subquery, chaining steps into a pipeline, and recursive CTEs for hierarchies.

    6:24 0 views Published
    Watch
  3. 06

    SQL Window Functions

    Compute across rows and keep every row: GROUP BY versus OVER, PARTITION BY and ORDER BY, ROW_NUMBER, RANK and DENSE_RANK, LAG, and running totals.

    7:50 0 views Published
    Watch

Part threeThe question families

  1. 07

    SQL Interview Prompts: Ranking and Presence

    The four families of SQL interview prompts, then the first two worked: latest per customer with ROW_NUMBER, repeated values with GROUP BY and HAVING, and active in one month but not the next.

    6:01 0 views Published
    Watch
  2. 08

    SQL Interview Prompts: Time-Series

    Running totals and month-over-month change as interviews ask for them: window SUM and its peer trap, fix the grain before LAG, the missing month, then the cheat sheet for all four families.

    4:58 0 views Published
    Watch