Final answer:
The correct answer is c) SELECT pilot_id FROM pilots GROUP BY pilot_id HAVING COUNT(departures) > 20 ORDER BY pilot_id ASC.
Step-by-step explanation:
The correct answer is c) SELECT pilot_id FROM pilots GROUP BY pilot_id HAVING COUNT(departures) > 20 ORDER BY pilot_id ASC.
In this query, we want to produce a unique list of pilot IDs of pilots who piloted more than 20 departures.
- The SELECT statement is used to specify the columns we want to retrieve from the table.
- The pilot_id column is selected to retrieve the pilot IDs.
- The GROUP BY clause is used to group the results by pilot_id.
- The HAVING clause is used to filter the groups based on the count of departures.
- The COUNT(departures) function counts the number of departures for each pilot_id.
- The ORDER BY clause is used to sort the result in ascending order based on pilot_id.