← All SQL interview questions

Rank support agents within their team

MediumWindow FunctionsEXLRSystemsSwiggy

A support operations lead publishes a leaderboard per team without losing the individual rows.

From agent_performance, return agent_name, team, tickets_closed and team_rank, where team_rank is the agent's position within their own team ordered by tickets_closed descending. Agents tied on volume must share the same rank, and the next rank should not be skipped.

Sample data

Table: agent_performance

15 row(s) · showing first 8

agent_idINTagent_nameTEXTteamTEXTtickets_closedINT
1Ishita KarBilling182
2Rehan SheikhBilling204
3Vidya RaoBilling182
4Sanjay MahtoBilling150
5Aparna SalviOnboarding221
6Deepak RawatOnboarding198
7Noor FatimaOnboarding221
8Girish KamathOnboarding176