Code for Geniuses
← Blog

🎤

Career · November 3, 2026 · 6 min read

How to prepare for a SQL interview

What they ask, how to think out loud and the five topics that can't be missing.

In almost any interview for a data role there will be a SQL test. They aren't looking for you to know every function by heart: they want to see how you reason through a business question.

The five most common topics

  • •Filtering and sorting (WHERE, ORDER BY, LIMIT).
  • •Grouping (GROUP BY, HAVING, COUNT, SUM, AVG).
  • •Joining tables (INNER JOIN and LEFT JOIN, and when nulls appear).
  • •Subqueries and CTEs (WITH).
  • •Window functions (ROW_NUMBER, RANK, LAG).

Think out loud

Before writing, repeat the question in your own words, say which tables you need and what shape the result will have (one row per customer, per month…). If you go wrong, the interviewer can steer you; if you're silent, they can't.

Check your result

  • •How many rows did you expect? How many come out?
  • •Did a JOIN accidentally duplicate rows?
  • •What happens with NULL values?

🦉 Tip: Practice with a timer: answering one question calmly in 10 minutes is worth more than answering ten in a rush.