Question: What are the drivers' last names and id who had 11 pit stops and participated in more than 5 race results?
Schema: create table drivers (surname varchar, driverid varchar, PRIMARY KEY (surname)); create table results (driverid varchar, PRIMARY KEY (driverid)); create table pitstops (driverid varchar, PRIMARY KEY (driverid))
SQL: 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