In short
In a live SQL round, the interviewer cares as much about how you think as whether the query runs. Talking through a clear process often matters as much as the final answer.
Live SQL rounds give you a schema and a question to solve while talking. Interviewers look for clarifying questions, a clear step-by-step approach, correct handling of NULLs and duplicates, and a quick check of the result.

Think of it like this
Cooking in front of judges
On a cooking show, judges watch every step. The contestant who explains "I'm browning the onions first for sweetness" scores better than one who cooks in silence, even if both dishes taste fine. Narrate your SQL the same way.
Watch it happen
How to tackle a live SQL question
1/5"Second highest salary per department." Ask: what if two people tie? What if a department has one person?
The big ideas
What you need to know
Clarify before typing
Ask about ties, NULLs, duplicates and expected output. Interviewers often leave these vague on purpose.
Build in CTEs
Break the problem into named steps. It's easier to explain, debug and read under pressure.
Know window functions
ROW_NUMBER, RANK, DENSE_RANK, LAG and running SUMs show up in most analyst SQL rounds.
Think out loud
If you get stuck, say what you're trying. Interviewers can nudge you only if they know where you are.
See it in code
Walk through the code
1WITH ranked AS (2 SELECT3 department,4 employee_name,5 salary,6 DENSE_RANK() OVER (7 PARTITION BY department ORDER BY salary DESC8 ) AS rnk9 FROM employees10)11SELECT department, employee_name, salary12FROM ranked13WHERE rnk = 2;1/3A CTE holds the ranked rows, so the final query stays simple.
A classic question. DENSE_RANK handles ties so the second distinct salary is found even if two people share the top one.
Save yourself the pain
Common mistakes
Oops
Starting to type immediately and discovering halfway that you misread the question.
Do this instead
Restate the question and ask about edge cases first. Thirty seconds saves five minutes.
Oops
Going silent for minutes when stuck.
Do this instead
Say what you're considering. "I think a self-join works, but a window function may be cleaner."
Your mission
Practise out loud
Quick check
Salaries in one department are 90, 90, 80. Using DENSE_RANK, which salary gets rank 2?
Go deeper
- 1Practise timed problems on joins, GROUP BY and window functions.
- 2Say your plan out loud before writing any SQL.
- 3Finish every answer by testing it against edge cases such as ties, NULLs and empty groups.
Also part of these roadmaps
More topics at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.