The following relations keep track of airline flight information:
Aircraft (aircraft_number, aircraft_make, cruisingrange)
Certified (pilot_id, aircraft_number)
Pilot (pilot_id, pilot_name, salary)
Note that italic attributes denote primary keys. In this scheme every pilot is certified for some aircraft. Write each of the following queries in SQL Format.
(ii) Find the names of pilots who can operate planes with a range greater than 2,000 miles but are not certified on any Boeing aircraft.
我的猜测是先将PILOT加入CERTIFIED,然后再加入AIRCRAFT,然后再加入GROUP BY PILOT.pilot_id,但是除此之外,我不确定如何过滤pilot_id以排除那些至少有2000巡航范围的飞机而且没有飞机的飞机_make’波音’？
select p.pilot_name from pilot p join certified c on p.pilot_id = c.pilot_id join aircraft a on c.aircraft_number = a.aircraft_number where a.cruisingrange > 2000 and p.pilot_id not in ( select c.pilot_id from certified c join aircraft a on c.aircraft_number = a.aircraft_number where a.aircraft_make = 'BOEING' ) group by p.pilot_id