Interview Query

Ticket Agent Analysis

Start Timer

0:00:00

Upvote
1
Downvote
Save question
Mark as completed
View comments (15)
Next question

The support team at your company is trying to analyze ticketing data to improve response times. They have noticed that a significant number of tickets have no assigned agent, making it difficult to track the progress of these tickets.

Write a SQL query to count the total number of tickets, the number of tickets assigned to agents, and the number of tickets that are not assigned to any agent.

Note: Tickets that are not assigned to any agent have NULL in their agent_id field.

Example:

Input:

tickets table

Column Type
id INTEGER
issue VARCHAR
agent_id INTEGER
created_at TIMESTAMP
updated_at TIMESTAMP

Output:

Column Type
total_tickets INTEGER
tickets_with_agent INTEGER
tickets_without_agent INTEGER
.
.
.
.
.


Comments

Loading comments