AnalystPath

Agents With a Dominant Contact Channel

SQLMediumMid level~15 min

Problem

A customer-support platform logs every conversation an agent handles in the table `support_logs`, one row per conversation, recording the `agent_id`, the `ticket_ref`, and the `channel` it came through (such as 'email', 'phone', 'chat', or 'social'). Management wants the *channel specialists*: agents who handled at least 5 conversations and where at least 60% of those conversations came through a single channel. For each such agent return the `agent_id`, that leading channel as `top_channel`, and the share of their conversations on it as `channel_share` rounded to 2 decimals. Order the result by `channel_share` from highest to lowest, then by `agent_id` ascending.

Tables

Example rows — the live problem includes the full dataset.

support_logs
agent_idticket_refchannel
11001email
11002email
11003email

Expected output

Your answer should return 2 rows with the columns agent_id, top_channel, channel_share.

Starter code (SQL)

SELECT *
FROM support_logs;

Solve this SQL question free

Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.

Solution & explanation

Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.

Sign up free to unlock

Related SQL questions