SQL 语句的效率比较

低效: TOP 1 高效: MAX

低效: SELECT … FROM DEPT WHERE SAL * 12 > 25000; 高效: SELECT … FROM DEPT WHERE SAL >25000/12;

低效: SELECT * FROM EMP WHERE DEPTNO >3 高效: SELECT * FROM EMP WHERE DEPTNO >=4

低效:SELECT * FROM LOCATION WHERE LOC_ID = 10 OR LOC_ID = 20 OR LOC_ID = 30

高效:SELECT * FROM LOCATION WHERE LOC_IN IN (10,20,30);

你可能感兴趣的:(sql)