What are the last names and ids of all the drivers?
select surname, driverid from drivers
Show those who had 11 pit stops.
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
Among those, who also participated in more than 5 race results?
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