select o.cid from orders o,agents a,customers c where o.cid=c.cid and c.city=a.city
解决方案 »
- 调用oracle存储过程 【输入字符串的格式不正确】问题
- Oracle 11g RAC系列一【分享】
- SQL记录练号显示问题求解
- 机子中的一个oracle进程ora_dbwr_ora占用cpu特别大,请问高手,怎么回事?用w命令特别慢
- ORACLE导出和pl/sql导出
- 请问用一条SQL语句怎么写下面的需求,把所要求的字段都显示出来,在线等,及时交流
- 请问 数据库名.ora 文件误删还能恢复吗?
- 请用ORACLE的朋友进来
- 请教哪本讲oracle9i的DBA的书是最好的?
- #我在机器上装了oracle 9i,后装了plsql,连接服务器上的oracle8,但在 PLSQL里面的中文是乱码,请问:如何显示中文?
- 在用net8 configration asistant配置监听器时出错,求教!在线给分!不够再加!
- 为什么我在Oracle8.17中以internal身份登陆时不需要密码?
select cid from orders group by cid having count(ordno)>1;通过同城市的代理商来定购的顾客:
select ord.cid from orders ord,customers cst,agents agt
where ord.cid=cst.cid and ord.aid=agt.aid and cst.city=agt.city;检索出订购了至少一样产品且所有的产品都通过同城市的代理商来订购的顾客CID:
select a.cid from
(select cid from orders group by cid having count(ordno)>1)a,
(select ord.cid from orders ord,customers cst,agents agt
where ord.cid=cst.cid and ord.aid=agt.aid and cst.city=agt.city)b
where a.cid=b.cid
select distinct o.cid from agents a,orders o,customers c where o.cid=c.cid and o.aid=a.aid and c.city=a.city;
select c.cid from customers c where not exists
(
select * from products p,orders o where o.pid=p.pid and o.cid=c.cid and o.qty>1 and
not exists
(
select * from agents a where a.aid=o.aid and a.city=c.city
)
);