Context: CREATE TABLE CAR_NAMES (model VARCHAR); CREATE TABLE MODEL_LIST (Maker VARCHAR, model VARCHAR); CREATE TABLE CAR_MAKERS (Id VARCHAR, Maker VARCHAR)
Question: What are the ids and makers of all car makers that produce at least 2 models and make more than 3 cars?
Answer: SELECT T1.Id, T1.Maker FROM CAR_MAKERS AS T1 JOIN MODEL_LIST AS T2 ON T1.Id = T2.Maker GROUP BY T1.Id HAVING COUNT(*) >= 2 INTERSECT SELECT T1.Id, T1.Maker FROM CAR_MAKERS AS T1 JOIN MODEL_LIST AS T2 ON T1.Id = T2.Maker JOIN CAR_NAMES AS T3 ON T2.model = T3.model GROUP BY T1.Id HAVING COUNT(*) > 3