SQL interview questions
49 questionsJoins, group by, window functions and the classic interview problems, on six connected tables.
Select and filter
Group and aggregate
Joins
Subqueries and CTEs
Window functions
Interview classics
- Second highest salaryMedium
- Employees on the third highest salaryMedium
- Employees who manage nobodyMedium
- Paid above their region averageMedium
- Levels in a hierarchyHard
- Find repeated rowsEasy
- Latest row per customerMedium
- Customers active every quarterMedium
- Top three in each groupHard
- Cumulative share of revenueHard
- Median sale amountMedium
- Pivot with conditional aggregationMedium
- Conditional countsEasy
- Percent of total with a windowMedium
- Customers with no sale in a yearMedium
- Customers active in both monthsMedium
- Join on a date windowMedium
- Longest streak of daysHard