What is the name of the customer who has the most policies listed?
select t1.customer_name from customers as t1 join customers_policies as t2 on t1.customer_id = t2.customer_id group by t1.customer_name order by count(*) desc limit 1
How many policy types has the customer listed?
select distinct count(*) from customers as t1 join customers_policies as t2 on t1.customer_id = t2.customer_id join available_policies as t3 on t2.policy_id = t3.policy_id where t1.customer_name = (select t1.customer_name from customers as t1 join customers_policies as t2 on t1.customer_id = t2.customer_id group by t1.customer_name order by count(*) desc limit 1)
List all of them please.
select distinct t3.policy_type_code from customers as t1 join customers_policies as t2 on t1.customer_id = t2.customer_id join available_policies as t3 on t2.policy_id = t3.policy_id where t1.customer_name = (select t1.customer_name from customers as t1 join customers_policies as t2 on t1.customer_id = t2.customer_id group by t1.customer_name order by count(*) desc limit 1)