。
Select sno from spj
Where jno=‘J1’;
。
Select sno from spj
Where jno=‘J1’ and pno=‘P1’;
1
。
Select sno from spj, p
Where = and jno=‘J1’ and color=‘红’;
或:
Select sno from spj
Where jno =‘J1’ and pno in
(Select pno from p
where color=‘红’ );
2
。
Select jno
From j
Where not exists
(Select *
From spj, s, p
where = and =
and = and =‘天津’
and =‘红’ );
3
。
即查找:不存在这样的零件y,供应商S1供应了y,而工程x为选用y。
Select distinct jno
From spj z
Where not exists
(select *
from spj x
where sno=‘S1’
and not exists
(select *
from spj y
where = and =));
4
1. 找出所有供应商的姓名及其所在城市。
Select sname, city
from s;
2. 找出所有零件的名称、颜色、重量。
Select pname, color, weight
from p;
。
Select jno
from spj
where sno=‘S1’;
5
所使用的各种零件的名称及其数量。
Select ,
from p, spj
where = and =‘J2’;
。
Select distinct pno
from spj
where sno in
(Select sno
from s
where city=‘上海’);
6
6. 找出使用上海产的零件的工程项目名。
Select jname
from j,spj,s
where =
数据库答案 第三章习题参考答案ppt课件 来自淘豆网www.taodocs.com转载请标明出处.