ITPub博客

首页 > Linux操作系统 > Linux操作系统 > oracle sql调优系列2(10g等效语句)

oracle sql调优系列2(10g等效语句)

原创 Linux操作系统 作者:alsrt 时间:2012-06-05 22:40:03 0 删除 编辑
SELECT LOCATION_ID,CITY
FROM HR.LOCATIONS
WHERE LOCATION_ID =10
UNION
SELECT LOCATION_ID ,CITY
FROM HR.LOCATIONS
WHERE CITY='Sao Paulo'
 
等效于
 
SELECT LOCATION_ID,CITY
FROM HR.LOCATIONS
WHERE LOCATION_ID =10
or CITY='Sao Paulo'
 
-------------------------------------------------------------------------------------------------------
SELECT LOCATION_ID,CITY
FROM HR.LOCATIONS
WHERE LOCATION_ID =10 or LOCATION_ID=20 or LOCATION_ID=30
 
等效于
 
SELECT LOCATION_ID,CITY
FROM HR.LOCATIONS
WHERE LOCATION_ID in (10,20,30)
 
----------------------------------------------------------------------------------------------------
SELECT * FROM EMP where empno=7902 and  DEPTNO IN (SELECT DEPTNO FROM DEPT WHERE JOB='ANALYST')
 
等效于
 
SELECT  * FROM EMP b WHERE empno=7902 and  exists (SELECT e.deptno FROM  DEPT e WHERE e.DEPTNO=b.DEPTNO and
 b.JOB='ANALYST')
 
 
 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8410760/viewspace-732004/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2011-05-02

  • 博文量
    34
  • 访问量
    33667