How do you check that the numbers from your SQL query are correct before you share them?
What the interviewer wants to hear
- Checks row counts and uniqueness of keys before and after joins
- Compares totals with a trusted source or a previous report
- Spot-checks a few individual records by hand
- Looks for NULLs, duplicates and odd values
- Asks whether the result makes business sense
Model answer
I check in layers. First, row counts: I count rows in each table and after each join, and confirm the join keys are unique where I expect them to be, because a duplicated key silently inflates totals. Second, I reconcile a headline number such as last month revenue with a trusted source like the finance report or an existing dashboard. Third, I pick three or four real customers or orders and trace them by hand through the query to see that each step does what I think. I also scan for NULLs, negative amounts, future dates and test accounts. Finally, I ask if the result makes sense: if conversion suddenly doubled, I assume a bug before a miracle. When something still looks uncertain, I say so clearly in the summary instead of hiding it.
Can you answer it under time pressure?
Take a timed easy round and get scored on every answer.
More easy Data Analyst questions
- Explain the difference between INNER JOIN, LEFT JOIN and FULL OUTER JOIN with a simple example.
- You receive a new dataset from a client. What steps do you take to clean it before analysis?
- When would you use the median instead of the mean? Give a business example.
- How do you decide which chart to use for a piece of data?
- How would you explain a data finding to a manager who is not technical?
- Walk me through one analysis you did from start to finish.
- What is the difference between VLOOKUP and XLOOKUP, and which do you prefer?
- What is the difference between a metric and a KPI? Give an example.
- You find duplicate customer records in a dataset. How do you handle them?