讲义上:
ORACLE采用自下而上的顺序解析WHERE子句,根据这个原理,表之间的连接必须写在其他WHERE条件之前, 那些可以过滤掉最大数量记录的条件必须写在WHERE子句的末尾. 测试:
select count(*) from person p where dept_id=1; 发现6975条select count(*) from person p where p.sex=1 发现50015条但是
select count(*) from person p where dept_id=1 and p.sex=1
和
select count(*) from person p wherep.sex=1 and dept_id=1
执行的时间一样
ORACLE采用自下而上的顺序解析WHERE子句,根据这个原理,表之间的连接必须写在其他WHERE条件之前, 那些可以过滤掉最大数量记录的条件必须写在WHERE子句的末尾. 测试:
select count(*) from person p where dept_id=1; 发现6975条select count(*) from person p where p.sex=1 发现50015条但是
select count(*) from person p where dept_id=1 and p.sex=1
和
select count(*) from person p wherep.sex=1 and dept_id=1
执行的时间一样
解决方案 »
- 请教统计的SQL写法
- oracle数据库启动错误
- oracle 大量数据的更新问题
- 如何得到所有关键字
- sql求大神解决
- ORA-3137?
- rman问题
- 哪位大侠能提供如下trigger:把数据的更新动作保存到某一个中间表。我自己通过程序把中间表中的更新动作对另外一个表进行更新。
- 各位老大,如果我在oracle中将值为中文的字段作为主键,对数据的查询和更新有影响吗?
- INS-20802] Oracle Net Configuration Assistant 失败
- apex3.2 创建后执行apex_epg_config失败, apex无法登录管理界面
- sequence.nextVal为何总是被执行
表之间的连接 是指表间关系 例如 select count(p.id) from person p ,class t where p.id=t.id