请问以下三语句的区别 谢谢! 回复都有分啊
select a,b from tb1 ,tb2 where tb1.no=tb2.noselect a,b from tb1 join tb2 on tb1.no=tb2.noselect a,b from tb1 where exists(select * from tb2 where tb1.no=tb2.no)
select a,b from tb1 ,tb2 where tb1.no=tb2.noselect a,b from tb1 join tb2 on tb1.no=tb2.noselect a,b from tb1 where exists(select * from tb2 where tb1.no=tb2.no)
解决方案 »
- 动态sql语句报java.sqlException 报无效索引列
- 在使用merge时出现ORA-30926: 无法在源表中获得一组稳定的行
- 现在想用触发器做实时备份到另外一台服务器上,但怕影响数据库的效率?有高招吗?
- pde文件进行导入时,提示表空间不存在
- to_char的用法 急救!!
- linux下安装oracle!!!????
- trigger调用procedure报错 java.security.AccessControlException,怎么解决啊?
- 初学者的问题
- 出错了
- 在Oracle8i数据库中,怎样实现每天自动执行同一段SQL语句.
- ORACL 10G RAC 最近莫名其妙会很卡,ADDM查了出这种报告,什么意思啊?
- 新手 !! 问个问题 马上给分 谢谢大大
语句2为外联 但是好像没有直接就写个join的 应该指定连接方式 left join,right join,full join
语句3为条件查询 效率低 结果为t1和t2表中关联出都存在结果
可以比较的只能说是执行效率。
//此语句执行效率最高
select a,b from tb1 where exists(select * from tb2 where tb1.no=tb2.no)
//此语句执行效率第二
select a,b from tb1 join tb2 on tb1.no=tb2.no
//执行效率第三
select a,b from tb1 ,tb2 where tb1.no=tb2.no
我用公司的表进行了关联总共有 135018 条数据执行效率如下
exists 为 0.011S
join 为 0.047S
等连接 为 0.062S