1.检索出向供应商S3发过订购单的职工的职工号和仓库号
①自然连接
select 职工.职工号,职工.仓库号 from 职工,订购单
where 职工.职工号=订购单.职工号 and 供应商号='S3'
②in 连接
select 职工号,仓库号 from 职工 where 职工号 in
(select 职工号 from 订购单 where 供应商号='S3'
③join on连接
select 订购单.职工号,仓库号 from 职工 join 订购单
on 订购单.职工号=职工.职工号
where 供应商号='S3'
④exists连接
select 职工号,仓库号 from 职工 where
exists(
select *from 订购单 where 职工.职工号=订购单.职工号 and 供应商号='S3'
2.检索出目前与S3供应商没有联系的职工信息
①自然连接
select distinct 职工.职工号,仓库号,工资 from 职工,订购单
where 职工.职工号=订购单.职工号 and 订购单.供应商号 !='S3'
②in 连接
SELECT * FROM 职工
WHERE 职工号 not in (SELECT 职工号 FROM 订购单 WHERE 供应商号='S3' AND 订购单.职工号 is not null)
③join on连接
select distinct 仓库号,工资,职工.职工号 from 职工 join 订购单
on 订购单.职工号=职工.职工号 where 供应商号 !='S3'
④exists连接
select * from 职工
where exists(
select * from 订购单 where 订购单.职工号=职工.职工号 and 订购单.供应商号 !='S3')