Skip to content
ML Academy

S06 · interview simulation

SQL gym: consecutive nearly-full streaks and why the first query lies

People, data and outputs in this scenario are simulated. Each stage is recorded when you commit; the reveal comes after.

  • 5stages
  • 35 minabout
  • 0stages committed

The brief

A live SQL interview (simulated). The interviewer gives you the course's synthetic flight_day table (one row per flight and date, 2022-01-01 to 2024-12-31, route, date as ISO text, flight_no, load_factor) in SQLite.

The question: "For each route, find the longest streak of consecutive calendar dates on which at least one of its flights had load_factor of 0.90 or more. Return the route, the start date, the end date and the length in days." A route has one to three flights per day. The table has no missing dates.

Stage 1 of 5

The interviewer says: "Talk me through the approach before you write anything. Keep it portable; assume window functions are available."

Which approach do you take?

Sign in to play scenarios (answers are recorded before the reveal).