SQL Interview: Normalisation, NULL and Query Optimisation
Design and correctness questions: the normal forms, why NULL breaks intuition, and how to answer "this query is slow, what do you do?"
Notes related to SQL.
95 notes tagged
Design and correctness questions: the normal forms, why NULL breaks intuition, and how to answer "this query is slow, what do you do?"
The performance and concurrency half of a SQL interview: how indexes work, what they cost, ACID, isolation levels and deadlocks.
GROUP BY rules, HAVING versus WHERE, the NULL behaviour of aggregates, and the subquery questions that separate confident answers from vague ones.
The questions asked in almost every SQL interview, with short answers you can actually say out loud and the follow up the interviewer will ask next.
Six end to end problems of the kind real work produces - a sales report, a retention table, a data quality audit, a duplicate cleanup and two optimisa...
Twelve harder exercises - correlated subqueries, recursive CTEs, ranking, running totals and top N per group - with solutions and the reasoning behind...
Fifteen exercises combining joins, grouping and having, each with the solution and a note on the trap it was designed to expose.
Twenty graded exercises on SELECT, filtering, sorting and simple functions, each with a worked solution and the reason it is written that way.
How much portability is worth paying for, which constructs are safe everywhere, and how to isolate the parts that can never be portable.
One reference table for the differences that actually break code: paging, auto increment, strings, dates, upserts and the features each product lacks.
Controlling who can do what: creating users, granting the minimum needed, grouping privileges into roles, and the accounts a typical application actua...
Why string concatenation lets user input rewrite your query, and why prepared statements make it structurally impossible - with the cases parameters c...