Interview preparation
Advanced SQL Interview Questions: Patterns and Practice
Advanced SQL interview patterns: gaps and islands, relational division, pivots, percentile ranking, and window-function choreography — with hard practice questions.
What 'advanced' means in SQL interviews
Advanced questions combine two or three patterns: a CTE that dedupes, a window that numbers, an outer filter — or a pivot built from conditional aggregation, or relational division (customers who bought all products).
The differentiator is sequencing: being able to decompose a three-step problem into named, testable stages.
Practice questions
- easyRising Temperature
- mediumConsecutive Login Days
- mediumConsecutive Numbers
- mediumFirst and Last Order Per Customer
- mediumGame Play Analysis IV
- mediumImmediate Food Delivery
- mediumLatest Event Per User
- mediumLongest Login Streak
- mediumMonthly Sales Ranking
- mediumNth Highest Salary
- mediumOrders Gap Analysis
- mediumPercentage of Total Sales
- mediumPivot Quarterly Sales
- mediumRank Scores
- mediumRunning Total
- mediumSeven-Day Rolling Average
- mediumUsers With the Most Friends
- hardTop Three Per Category