human
Schema:
Customers (Customer_ID, Customer_name)
Services (Service_ID, Service_name)
Available_Policies (Policy_ID, policy_type_code, Customer_Phone)
Customers_Policies (Customer_ID, Policy_ID, Date_Opened, Date_Closed)
First_Notification_of_Loss (FNOL_ID, Customer_ID, Policy_ID, Service_ID)
Claims (Claim_ID, FNOL_ID, Effective_Date)
Settlements (Settlement_ID, Claim_ID, Effective_Date, Settlement_Amount)
Please answer with SQL.
assistant
Sure, I understand.
human
What is the most popular policy type?
assistant
SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY COUNT( * ) DESC LIMIT 1;
human
Show me all the customer phone numbers associated with it.
assistant
SELECT customer_phone FROM available_policies WHERE policy_type_code = ( SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY COUNT( * ) DESC LIMIT 1 ) ;