---------
route |
---------
rNo(PK) |
rDescript|
dNo(FK) |
--------------------
Ability |钮代表
-----------
bdNo(PK,FK)|
rNo(FK,PK) |
--------------------
BusDriver|
---------
bdNo(PK) |
bdName |
bdSalary |
pcvDate |
dNo(FK) |
---------
route和BusDriver表为多对多关系
Use "not exists "list all busdrivers (name and number) who are on the system but are not yet responsible for a route.
用"not exists "方法列出所有没有工作在任何一条线路(route)上的司机(busdrivers)的名字和号码:
--下面的代码是我错误的代码显示为未选定行
select bdno,bdname
from busdriver bd
where not exists
(select*
from route r
where not exists
(select*
from ability a
where a.rno=r.rno
and a.bdno=bd.bdno))
route |
---------
rNo(PK) |
rDescript|
dNo(FK) |
--------------------
Ability |钮代表
-----------
bdNo(PK,FK)|
rNo(FK,PK) |
--------------------
BusDriver|
---------
bdNo(PK) |
bdName |
bdSalary |
pcvDate |
dNo(FK) |
---------
route和BusDriver表为多对多关系
Use "not exists "list all busdrivers (name and number) who are on the system but are not yet responsible for a route.
用"not exists "方法列出所有没有工作在任何一条线路(route)上的司机(busdrivers)的名字和号码:
--下面的代码是我错误的代码显示为未选定行
select bdno,bdname
from busdriver bd
where not exists
(select*
from route r
where not exists
(select*
from ability a
where a.rno=r.rno
and a.bdno=bd.bdno))
from busdriver a
where not exists
(select 1
from route b, ability c
where b.rNo=c.rNo and a.dNo=b.dNo and a.bdNo=c.bdNo)