Table: callers
+---------------------+-----------+ | Column Name | Type | +---------------------+-----------+ | policy_holder_id | integer | | case_id | varchar | | call_category | varchar | | call_date | timestamp | | call_duration_secs | integer | +---------------------+-----------+
case_idis the primary key. Each row represents one support call made by a policy holder.
United Group flags policy holders for investigation when they make three or more calls. Write a query to find the number of such policy holders. Return the result in a column named policy_holder_count.
The result format is shown below.
Example
Input:
callers table: +------------------+---------+---------------------+----------------------+--------------------+ | policy_holder_id | case_id | call_category | call_date | call_duration_secs | +------------------+---------+---------------------+----------------------+--------------------+ | 1 | 123456 | emergency assistance| 2023-04-13T19:16:53Z | 144 | | 1 | 123457 | authorisation | 2023-05-25T09:09:30Z | 815 | | 2 | 123458 | claims assistance | 2023-01-26T01:21:27Z | 992 | | 2 | 123459 | emergency assistance| 2023-03-09T10:58:54Z | 128 | | 2 | 123460 | benefits | 2023-06-05T07:35:43Z | 619 | +------------------+---------+---------------------+----------------------+--------------------+Output:
+---------------------+ | policy_holder_count | +---------------------+ | 1 | +---------------------+Explanation:
Policy holder 1 made 2 calls (does not reach the threshold). Policy holder 2 made 3 calls (qualifies). The count of qualifying holders is 1.
Accepted
13/18
Acceptance Rate72.2%
Ask AI Assistant

Ask AI Assistant
Ask me anything about this coding question!
Test Cases
Input
-
Output
-
Expected
-