-
--在sal列上创建非唯一索引
-
scott@TESTDB11>create index idx_emp1_sal on emp1(sal);
-
-
Index created.
-
-
--查询年薪 > 20,000的员工的编号、姓名、薪水、年薪
-
--不走索引
-
select empno, ename, sal, sal * 12 from emp1 where sal * 12 > 20000;
-
--修改为等价的写法,走索引
-
select empno, ename, sal, sal * 12 from emp1 where sal > 20000 / 12;
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/17013648/viewspace-1070753/
,如需转载,请注明出处,否则将追究法律责任。