Active Customer Analysis
Amazon 👶 Easy SQL
Beginner Mode

Objective

Write a SQL query to find the number of policy holders who made three or more calls to customer support.

Table Schema:

  • callers
Column Type Description
policy_holder_id INTEGER Unique identifier for the policy holder
case_id VARCHAR Unique identifier for each support call
call_category VARCHAR Category of the call (e.g., billing, claims, general inquiry)
call_date DATE Date when the call was made
call_duration_secs INTEGER Duration of the call in seconds

Task Requirements:

  • Count the number of calls per policy holder using case_id
  • Filter for policy holders with 3 or more calls
  • Return the total count of such policy holders

Output columns: policy_holder_count

Examples

Example 1:

Input:

callers
call_categorycall_datecall_duration_secscase_idpolicy_holder_id
billing2024-01-10300C001101
claims2024-02-15450C002101
general2024-03-20200C003101
billing2024-01-25350C004102
claims2024-02-28400C005102
general2024-03-05250C006103

Output:
policy_holder_count
1
Quick Solution

Code Environment

Sign in or try as guest to run your code.

Sign In

Track

Question Difficulty Company Access
Need more practice in this area? Explore more questions →