Window Functions SQL interview questions
Window functions are the most-tested advanced SQL topic in data interviews. Practise ranking, LAG/LEAD comparisons, partitioned aggregates and explicit ROWS frames.
- Products Priced Above Their Category AverageWindow Functions · Subqueries & CTEseasy
- Most Recent Order per CustomerWindow Functions · Ranking & Top-N per Groupeasy
- Top 2 Products in Each CategoryfreeWindow Functions · Ranking & Top-N per Groupmedium
- Running Revenue Total for 2025Running Totals & Rolling Windows · Window Functionsmedium
- Month-over-Month Revenue GrowthWindow Functions · Dates & Timemedium
- Time Between First and Second OrderWindow Functions · Dates & Timemedium
- Top 2 Earning Drivers in Each CityWindow Functions · Ranking & Top-N per Groupmedium
- Outcome of Riders' First RequestWindow Functions · Aggregation & GROUP BYmedium
- Longest Completed Trip in Each CityWindow Functions · Ranking & Top-N per Groupmedium
- Churned Accounts and Lost MRRWindow Functions · Dates & Timemedium
- Each Campaign's Share of Channel SpendWindow Functions · Aggregation & GROUP BYmedium
- Week-over-Week Spend by ChannelWindow Functions · Dates & Timemedium
- Best Day for Each CampaignWindow Functions · Ranking & Top-N per Groupmedium
- Customers Who Make Up Half of RevenueRunning Totals & Rolling Windows · Window Functionshard
- Riders with 3-Day Ride StreaksGaps & Islands · Window Functionshard
- Average Idle Time Between TripsWindow Functions · Dates & Timehard
- Median Fare by CityWindow Functions · Aggregation & GROUP BYhard
- Sessionize Events with a 30-Minute GapWindow Functions · Gaps & Islandshard
- Rolling 7-Day CTR for Brand SearchWindow Functions · Running Totals & Rolling Windowshard
- Last-Touch Attribution by ChannelfreeMarketing Attribution · Window Functionshard
- First-Touch Attribution with a 14-Day LookbackMarketing Attribution · Window Functionshard