select * from tbname1
where not exists (select 1 from tbname2 where tbname2.id=tbname1.id);
where not exists (select 1 from tbname2 where tbname2.id=tbname1.id);
解决方案 »
- 求教 基础题
- 将sql转换成oracle,就一条sql
- 求高手:oracle中的子查询中为什么不能有order by
- 问一个ORACLE的sql写法,求高手
- 麻烦各位前辈推荐几个新手入门的书,谢谢
- ★★★★★(9i+hp)字符集问题,大家看看这是什么错!
- FILE_DIR的文件路径动态设定可以吗
- 字段值是:1,10,3 或 1,3,10 或 1,2,10,4?? 谢谢
- 启动数据库使出现IO异常是怎么回事啊?
- 为什么connect sys/change_on_install as sysdba 有时会出现“已连接到空闲例程”。
- 请教一个关于三个表的SQL更新语句怎么写
- session可以达到多大
minus
select code from tab2
假设学号列为StNo
select table1.StNo from table1,table2 where
(table1.StNo = table2.StNo(+) and table2.StNo is null)
这条SQL语句的效率明显强于使用NOT IN. minus操作符是区间操作符,例如你要查询 rowum范围为 10-20的
数据:
select * from table1 where rownum<=10
minus
select * from table1 where rownum<=20
但是,在大数据量时效率比较低.