internalsGet Pro

Module 19 · Lesson 2 of 8Pro

SQL interview problems: patterns that repeat

Level
Intermediate
Topic
Data engineering interviews
Reading time
18 min

When you finish this page you can

  1. Recognise which pattern a SQL question is from its wording, before writing any SQL.
  2. Talk through a SQL problem in five moves: output grain, input grains, pattern, edge cases, check by hand.
  3. Solve top-N per group, streaks and cohort retention in DuckDB SQL, with ties, NULLs and duplicates handled on purpose.
  4. Answer the follow-ups an interviewer uses to probe a working query.

Builds on 4 lessons

Start with lesson 114 min
  1. Data engineering interviews: what companies test14 min
  2. Window functions: running totals and rankings17 min
  3. Sessionization: grouping events into visits with SQL17 min
  4. Deduplication: keeping one row per entity17 min

Two rows, both from Pune

is an online store in India. Its data team moves orders and click events from the store’s databases into the reports the business runs on. The team is hiring, and Meera, one of its data engineers, runs the SQL round. The round here is this lesson’s scenario, not any real company’s process.

Our biggest sale ever · Black Friday

Flat 50% Off

Pro

Continue reading

Unlock every course, now and later

  • System Design, live
  • AI Engineering, live
  • Data Engineering, live
  • Machine Learning Engineering, live
  • Inference Engineering, coming soon
  • AI Research, coming soon
  • Performance Engineering, coming soon
  • Agent & Harness Engineering, coming soon
  • LLM Fine-tuning, coming soon
  • LLM Pre-training & Post-training, coming soon
  • Reinforcement Learning, coming soon
  • AI Infrastructure & Platform Engineering, coming soon
  • AI Evaluation & Safety, coming soon
  • Forward Deployed Engineering, coming soon
  • Cloud Computing, coming soon
  • DevOps, coming soon

50% off · Annual and Lifetime

BLACKFRIDAY50Applied at checkout

Choose a plan