CREATE TABLE car_makers (id VARCHAR, maker VARCHAR); CREATE TABLE model_list (maker VARCHAR, model VARCHAR); CREATE TABLE car_names (model VARCHAR)
Which are the car makers which produce at least 2 models and more than 3 car makers ? List the id and the maker .
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