I have two interviews coming up for junior analyst roles. I can write joins and GROUP BY. Is that enough? What else should I practise?
What SQL do junior analyst interviews actually ask?
chloe_dubois0 views
chloe_dubois0 views
I have two interviews coming up for junior analyst roles. I can write joins and GROUP BY. Is that enough? What else should I practise?
Be kind and specific. Read the community guidelines.
Accepted answer
That list is right. Two details people trip on:
NULL is not equal to anything, not even another NULL. WHERE x = NULL never matches; write x IS NULL. And NOT IN (subquery) returns nothing at all if the subquery contains a NULL, which is why NOT EXISTS is safer.COUNT(*) counts rows and COUNT(column) skips NULLs.Practise saying your reasoning out loud while you write the query: say what the grain of the result is (one row per what?) before you start. Interviewers mostly want to see how you think when the data is awkward.
In the ones I did: joins (inner against left, and what happens to unmatched rows), GROUP BY with HAVING, finding duplicates, and one window function question, usually top N per group or a running total. Also what NULL does in comparisons.
Accepted answer
That list is right. Two details people trip on:
NULL is not equal to anything, not even another NULL. WHERE x = NULL never matches; write x IS NULL. And NOT IN (subquery) returns nothing at all if the subquery contains a NULL, which is why NOT EXISTS is safer.COUNT(*) counts rows and COUNT(column) skips NULLs.Practise saying your reasoning out loud while you write the query: say what the grain of the result is (one row per what?) before you start. Interviewers mostly want to see how you think when the data is awkward.
Six SQL interview questions, worked through covers exactly these topics with data and output, so you can compare your own answers.
Update after my interviews: both asked a top-N-per-group question and one asked about NULL in a join. The worked examples were close enough that I stayed calm. Thank you.