SQL Interview Prompts: Time-Series

Created by Abhyuday DesaiPublished , v1Runs 4 min 58 sec
0 views

About this video

The time-series family of SQL interview prompts, on one small orders table: a running total as a window SUM, where same-day rows share a total under the default RANGE frame until a tiebreaker is added; month-over-month change, where the first move is changing the grain in a CTE before LAG; and what happens when a month has no rows. The video closes on the cheat sheet for all four families: the family, its tell, and its construct.

You'll review how to:

  • Write a running total with an ordered window SUM, and say why the ORDER BY needs a unique key
  • Fix the grain in a CTE before comparing periods with LAG, and explain the first period's NULL
  • Spot a missing period, and when to build a complete series first
  • Name the family of a prompt from its wording and reach for its template

For engineers who know window functions and CTEs. The cheat sheet is the series' one-card summary.

What changed

  1. v103 Oct 2026abhydesai4 min 58 sec037acd5

    First published version.

    0 views0 likes on this version