Discussion about this post

User's avatar
Neural Foundry's avatar

Spot-on breakdown. The subquery approach for second-highest salary handling NULLs cleanly is exactly what separates candidates who memorize from those who understand defensive SQL. The WHERE vs HAVING distinction trips up way more people than it should, especailly once you start working with real datasets where execution order suddenly matters for performance. I've interviewed data analysts who could write the window function syntax but couldn't explain when ROW_NUMBER vs RANK actually makes a diference in production, and that gap shows up fast when stakeholders ask why two reports dont match.

Expand full comment
Benjamin Bennett Alexander's avatar

Thanks for sharing. 🙏🏽

Expand full comment

No posts

Ready for more?