Schema: CREATE TABLE drivers (forename VARCHAR, surname VARCHAR, driverid VARCHAR); CREATE TABLE results (driverid VARCHAR); CREATE TABLE pitstops (driverid VARCHAR)
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?
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