日期:2014-05-16 浏览次数:20413 次
表的查找:
select * from emp where (sal>500 or job='MANAGER') and ename like 'J%';
引号里边的字符是区分大小写的。
查找之后把结果排序:
select * from emp order by sal asc;
asc是升序,desc是降序
?
对列重命名,只要打个空格,后跟新列名就可以
select ename,sal*12+nvl(comm,0)*12 "年薪" from emp order by "年薪" asc;
此处的nvl是个小函数,如果comm是null的话,就用0代替
?
最大最小值函数:
SQL> select max(sal) "maxSal",min(sal) "minSal" from emp;
?
??? maxSal???? minSal?????????????????????????????????????????????? ????????????????????????????????????????????????????
---------- ----------??????????????????????????????????????????????????????????????????????????????????????????????????