Tested answers to the questions that come up again and again, from NULL traps to window functions, with the detail that makes each answer stand out.
SQL interviews for data roles keep coming back to the same few dozen ideas: how NULL behaves, what each join keeps, how window functions rank rows, and a handful of classic problems such as the second highest salary. Knowing the definitions is rarely enough. A strong answer shows that you have actually run the query and know where it breaks.
This article covers 25 of those questions in five parts. Each answer gives a short explanation, a query you can run, its real output and one point that makes the answer stand out.…