# SQL Interview Questions for Hiring Teams

> SQL interview questions for hiring teams: 15 questions with follow-ups, strong and weak answers, and how to run them at volume.

- URL: https://tracyinterview.ai/blog/sql-interview-questions
- Published: 2026-11-11
- Author: Tracy team

> **In short** **Tracy AI Interviewer** can run a SQL task inside the same interview and follow up on approach and trade-offs, so you hear how an analyst or engineer reasons, not only whether the query runs.
>
> Use the 15 SQL interview questions below, each with a follow-up and what to listen for.
>
> Every result keeps a recording, a timestamped transcript and a written assessment per question; your data lead decides.
>
> Next step: paste three of these questions into a Tracy interview.

We make Tracy AI Interviewer.

A data lead posts an analyst role and gets 150 applications. Every CV says SQL. The CV cannot tell you who writes a join that double counts revenue and who notices. SQL interview questions have to test that, so ask why a total is too high.

These 15 SQL interview questions are written for data leads and recruiters hiring analysts and data engineers. Each has a follow-up and a note on what a strong answer contains. They suit a first conversation of 20 to 30 minutes; a take-home or pairing round belongs later with your own team.

Tracy AI Interviewer runs that first conversation at volume. She asks each candidate questions in their own field, follows up on what they said and waits for the end of the thought. For the wider process, see [technical interviews](/use-cases/technical-interviews) and [AI technical interviews](/blog/ai-technical-interviews).

## Fifteen SQL interview questions, grouped by what they test

Pick one or two from each group. Ask the follow-up only after the first answer. Choose your opening questions for the role and write down what a strong answer contains before the first candidate joins.

### Group 1: reading the problem

*Table 1: Reading the problem, with follow-ups and what a strong answer contains.*

| Ask | Follow up with | Listen for |
| --- | --- | --- |
| 1. You get a table of orders. What do you ask before writing a query? | What would change your query most? | What one row means, the grain, the time zone, whether deleted or test rows exist. |
| 2. A colleague asks for "active users last month". How do you respond? | Who decides the definition? | Pins down active, month and users. Writes the definition down and gets it agreed. |
| 3. When do you use a subquery, a CTE or a temporary table? | When would you avoid a CTE? | Readability first, then reuse and cost. Knows it depends on the engine. |

### Group 2: joins and duplicates

*Table 2: Joins and duplicates, with follow-ups and what a strong answer contains.*

| Ask | Follow up with | Listen for |
| --- | --- | --- |
| 4. Orders join to payments, and revenue looks too high. Where do you look first? | How would you change the query so each order counts once? | The join. Counts per key, aggregates before joining, or a distinct on the right grain. |
| 5. When does a LEFT JOIN turn into an INNER JOIN by accident? | How would you spot it in a result? | A filter on the right table in the WHERE clause. Compares row counts before and after. |
| 6. How do you find rows in one table with no match in another? | Which approach would you pick on a large table, and why? | Anti-join, NOT EXISTS, NULL handling. Knows NOT IN with NULLs misleads. |

### Group 3: aggregation and windows

*Table 3: Aggregation and windows, with follow-ups and what a strong answer contains.*

| Ask | Follow up with | Listen for |
| --- | --- | --- |
| 7. How do you get the latest order for each customer? | What if two orders share a timestamp? | A window function with a tie-break. Says what to do on ties, not only how. |
| 8. What is the difference between WHERE and HAVING? | Give me a query where using the wrong one gives a wrong answer. | Row filter versus group filter, with a real example. |
| 9. Calculate a seven-day moving average. What can go wrong? | What if some days have no rows? | Gaps in dates, partial windows at the start, a calendar table. |

### Group 4: performance and scale

*Table 4: Performance and scale, with follow-ups and what a strong answer contains.*

| Ask | Follow up with | Listen for |
| --- | --- | --- |
| 10. A report query slows down as the table grows. What do you check? | What if the plan looks fine? | Reads the plan, indexes, scans, data skew, then load. Measures before changing. |
| 11. When does an index not help? | Which columns would you index for a query you choose? | Low selectivity, functions on columns, write cost. Picks columns with reasons. |
| 12. How would you move a heavy daily report off the live database? | How do you know the copy is correct? | Replica, summary table, schedule. A reconciliation check. |

### Group 5: trust in the numbers

*Table 5: Trust in the numbers, with follow-ups and what a strong answer contains.*

| Ask | Follow up with | Listen for |
| --- | --- | --- |
| 13. Tell me about a number you reported that was wrong. | What do you check now? | A real case, how they found it, and a routine they added. |
| 14. How do you test a query before someone relies on it? | What would you compare against? | Row counts, a known total, edge dates, a second method. |
| 15. How do you explain a result to someone who does not know SQL? | Show me with the last query you wrote. | Plain words, a caveat stated, no jargon. |

## A strong answer names what it would check, and a weak one recites syntax

The gap opens in the second answer. We wrote these pairs to show how it sounds; none is a quote from a real candidate.

*Table 6: Weak and strong answers to the same questions, written as examples.*

| | Weak answer | Strong answer |
| --- | --- | --- |
| Question 4, the inflated revenue | "I'd use DISTINCT." | "If an order has two payments, its amount counts twice. I'd sum payments per order first, then join, and check the total against the orders table." |
| Question 7, the latest order | "ORDER BY date DESC, LIMIT 1." | "That gives one row total. I'd rank within each customer and add an order id as a tie-break." |
| Question 13, the wrong number | "I've never reported a wrong figure." | "I joined on the wrong key once and overcounted by 8 percent. I now compare every total with a source count before I send it." |

Listen for ownership. A candidate who describes a mistake and the check they added has done the work.

## One follow-up chain shows where the real answer starts

This is an illustration with sample data, not a real interview. The candidate is fictional. It shows the shape of what Tracy runs: an opening question from your list, the answer, and a follow-up built on it. It starts from question 4.

> **Tracy:** Orders join to payments, and revenue looks too high. Where do you look first?
>
> **Candidate (fictional):** At the join. If an order has two payments, its amount counts twice.
>
> **Tracy:** How would you change the query so each order counts once?
>
> **Candidate:** I'd sum the payments per order in a subquery, then join that to orders.
>
> **Tracy:** How would you check the new total is right?
>
> **Candidate:** Compare it with the total in the orders table and spot-check two orders by hand.

The first answer is the textbook one. The third tells you whether the candidate verifies their own work.

![Transcript card: revenue looks too high, candidate says the join counts twice, Tracy asks how to count each order once.](/blog/images/sql-interview-questions-1.png)

*Tracy asks a follow-up built on the candidate's own answer. Your data lead hears whether the candidate checks their own work. Illustration with sample data*

A follow-up on the candidate's own answer shows whether they verify the numbers they report.

## Run the SQL interview for every applicant

A live call for every applicant does not survive 150 applications.

- **A SQL task inside the interview.** A SQL task can sit in the same interview as the spoken questions, with follow-ups on approach and trade-offs. Your team reads the answers and the transcript.
- **Your questions or ours.** Describe the role and Tracy drafts questions from the job description, which you edit; see the [product page](/product).
- **Start on click.** Each candidate opens a link in a browser, with no account and no calendar, at any hour, and is told on the join screen that the conversation is recorded and transcribed. See the [participant experience](/participant-experience).
- **A result you can check.** A recording and a timestamped transcript sit behind every result, with a written assessment per question. See [AI interview reports](/blog/ai-interview-reports).
- **Integrity signals, with the evidence.** Tracy captures tab changes, gaze, face detection, delay before answers, fullscreen exits and external screens and shows the evidence to a person. A signal is not proof; see [AI interview cheating detection](/blog/ai-interview-cheating-detection).

It is $1 per credit, one credit per started 20 minutes of an interview that produced a result. The first 3 results are free with no card, and there are no seats. See [pricing](/pricing).

![Tracy result for a fictional data analyst: four assessments and a highlighted 08:20 transcript answer.](/blog/images/sql-interview-questions-2.png)

*A recording and timestamped transcript sit behind every Tracy result. The reviewer checks the evidence before moving a candidate forward. Illustration with sample data*

Your data lead can open the recording and transcript behind each assessment before deciding.

## Keep three decisions with your team

1. **Who moves forward.** Your data lead reads the report and decides. A person has the last word.
2. **The calibration.** Have one analyst read five transcripts blind. If they disagree with the written assessments, change the questions before inviting the next hundred.
3. **The hands-on round.** A real dataset, a take-home or pairing stays with your team.

For a handful of hires, a call with a senior analyst is simpler; see [AI interview vs human interview](/blog/ai-interview-vs-human-interview). The case for Tracy starts when applicants outnumber your team's hours, as in [volume hiring](/use-cases/volume-hiring). Start small: take one analyst opening, use three of these questions and have your data lead read the first batch of reports before you widen it.

## Common questions

### What are good SQL interview questions?

Ask about reading the problem, joins and duplicates, aggregation and windows, performance, and how candidates check their numbers. Keep the follow-up beside each question, because that is where the real answer starts.

### What SQL interview questions suit a data analyst?

Lean on joins, windows and trust in the numbers. For a data engineer, add the performance and scale group and ask about moving heavy work off the live database.

### What SQL interview questions suit a data engineer?

Use the performance group and the reconciliation follow-ups: plans, indexes, replicas and how the candidate knows a copy is correct.

### Can Tracy run a SQL task in the interview?

Yes. A SQL task can sit in the same interview, with follow-ups on approach and trade-offs. The report gives a recording, a timestamped transcript and a written assessment per question.

### Does Tracy decide who to hire?

No. A person reads the evidence and decides.

---

Create an interview for this exact role from these questions, then read the recording and report; the button opens the Connect page. Or send us one role and we will build the interview plan, with a recording and report you can check. [Try it free](https://tracyinterview.ai/connect?utm_source=blog&utm_medium=seo&utm_campaign=sql-interview-questions&utm_content=try-free) · [Book a demo](https://cal.com/tracy-ai/tracy-demo-web?utm_source=blog&utm_medium=seo&utm_campaign=sql-interview-questions&utm_content=demo)

## Sources

- [Tracy AI Interviewer home page](https://tracyinterview.ai/), retrieved 9 Nov 2026.
- [Tracy AI Interviewer pricing](https://tracyinterview.ai/pricing), retrieved 9 Nov 2026.
- [Tracy AI Interviewer Connect page](https://tracyinterview.ai/connect), retrieved 9 Nov 2026.
