Question: Find the name of customers who have loans of both Mortgages and Auto.
Schema: create table customer (cust_name varchar, cust_id varchar, PRIMARY KEY (cust_name)); create table loan (cust_id varchar, PRIMARY KEY (cust_id))
SQL: select t1.cust_name from customer as t1 join loan as t2 on t1.cust_id = t2.cust_id where loan_type = 'mortgages' intersect select t1.cust_name from customer as t1 join loan as t2 on t1.cust_id = t2.cust_id where loan_type = 'auto'