Context: CREATE TABLE drivers (surname VARCHAR, driverid VARCHAR); CREATE TABLE results (driverid VARCHAR); CREATE TABLE pitstops (driverid VARCHAR)
Question: What are the drivers' last names and id who had 11 pit stops and participated in more than 5 race results?
Answer: SELECT T1.surname, T1.driverid FROM drivers AS T1 JOIN pitstops AS T2 ON T1.driverid = T2.driverid GROUP BY T1.driverid HAVING COUNT(*) = 11 INTERSECT SELECT T1.surname, T1.driverid FROM drivers AS T1 JOIN results AS T2 ON T1.driverid = T2.driverid GROUP BY T1.driverid HAVING COUNT(*) > 5