Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Top Agents by Resolved Cases

EasySQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is Top Agents by Resolved Cases. Start with the requirements and the one table on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

A CXone support team wants a quick leaderboard of agents who closed the most cases. Write a SQL query to return the top 3 agents by number of resolved cases.

Requirements

  1. Count only rows where status = 'Resolved'.
  2. Exclude rows where agent_name is NULL.
  3. Group results by agent_name.
  4. Sort by resolved case count in descending order, then by agent_name ascending to break ties.
  5. Return only the top 3 rows.

Schema

cxone_cases
ColumnTypeDescription
case_idPKINTUnique case identifier
agent_nameVARCHAR(100)Name of the agent assigned to the case
statusVARCHAR(30)Current case status
priorityVARCHAR(30)Priority level of the case
created_dateDATEDate the case was created
Tablescxone_cases
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results