gpt4 book ai didi

mysql - Mysql 查找飞机名称,使所有获得驾驶资格的飞行员的收入超过 80,000 美元

转载 作者:行者123 更新时间:2023-11-29 19:27:17 24 4
gpt4 key购买 nike

  1. 以下关系跟踪航空公司航类信息:

    FLIGHTS(flno: integer, from: string, to: string, distance: integer, departs:time,arrives: time, price: integer)
    AIRCRAFT(aid: integer, aname: string, cruisingrange: integer) CERTIFIED(eid: integer, aid: integer) EMPLOYEES(eid: integer, ename: string, salary: integer)

注意:-员工关系也描述了飞行员和其他类型的员工;每个飞行员都获得了某些飞机的认证,并且只有飞行员获得了某些飞机的认证飞翔。

问题:找到飞机的名称,使所有获得操作这些飞机资格的飞行员的收入超过 80,000 美元。

帮我解决这个问题。我的问题是

SELECT  DISTINCT A.aname FROM  AIRCRAFT A WHERE  A.Aid IN 
( SELECT C.aid FROM CERTIFIED C, EMPLOYEES E WHERE C.eid = E.eid AND NOT EXISTS
( SELECT * FROM EMPLOYEES E1 WHERE E1.eid = E.eid AND E1.salary < 80000 )) ;

即使该航类的任何员工的收入低于 80,000,此查询也会给出航类名称。

最佳答案

SELECT distinct aname FROM aircraft
JOIN certified ON aircraft.aid = certified.aid
JOIN employees ON employees.eid = certified.eid
WHERE employees.salary> 80000
AND aircraft.aid NOT IN
(SELECT aircraft.aid FROM aircraft
JOIN certified ON aircraft.aid = certified.aid
JOIN employees ON employees.eid = certified.eid
WHERE employees.salary <= 80000)

关于mysql - Mysql 查找飞机名称,使所有获得驾驶资格的飞行员的收入超过 80,000 美元,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42049608/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com