Question: What are the drivers' first, last names and id who had more than 8 pit stops or participated in more than 5 race results?
Schema: create table drivers (forename varchar, surname varchar, driverid varchar, PRIMARY KEY (forename)); create table results (driverid varchar, PRIMARY KEY (driverid)); create table pitstops (driverid varchar, PRIMARY KEY (driverid))
SQL: select t1.forename, t1.surname, t1.driverid from drivers as t1 join pitstops as t2 on t1.driverid = t2.driverid group by t1.driverid having count(*) > 8 union select t1.forename, t1.surname, t1.driverid from drivers as t1 join results as t2 on t1.driverid = t2.driverid group by t1.driverid having count(*) > 5