human
Schema:
Customers (Customer_ID, Customer_Details)
Customer_Policies (Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date)
Claims (Claim_ID, Policy_ID, Date_Claim_Made, Date_Claim_Settled, Amount_Claimed, Amount_Settled)
Settlements (Settlement_ID, Claim_ID, Date_Claim_Made, Date_Claim_Settled, Amount_Claimed, Amount_Settled, Customer_Policy_ID)
Payments (Payment_ID, Settlement_ID, Payment_Method_Code, Date_Payment_Made, Amount_Payment)
Please answer with SQL.
assistant
Sure, I understand.
human
Which kind of policy type was chosen by the most customers?
assistant
SELECT Policy_Type_Code FROM Customer_Policies GROUP BY Policy_Type_Code ORDER BY COUNT( * ) DESC LIMIT 1;
human
what about the least?
assistant
SELECT Policy_Type_Code FROM Customer_Policies GROUP BY Policy_Type_Code ORDER BY COUNT( * ) LIMIT 1;
human
What is Policy_Type_Code of Customer_ID 3?
assistant
SELECT Policy_Type_Code FROM Customer_Policies WHERE Customer_ID = '3';
human
What is the Start Date of Policy ID 143?
assistant
SELECT Start_Date FROM Customer_Policies WHERE Policy_ID = '143';
human
What is the Policy ID of Policy Type Life?
assistant
SELECT Policy_ID FROM Customer_Policies WHERE Policy_Type_Code = "Life" ;