select EMPNO,SAL from emp where SAL BETWEEN 1000 and 2000--从enp中获取sal中1000到2000之间的数据
select ENAME,SAL from emp where SAL >= 1000 and SAL <=2000--从enp中获取sal中1000到2000之间的数据
select ENAME,SAL from emp where SAl IN(1000,2300);
select EMPNO from emp ORDER BY EMPNO;--默认排序
select EMPNO from emp ORDER BY EMPNO ASC--升序
select EMPNO from emp ORDER BY EMPNO DESC--降序
select LOWER( ENAME) from emp --大小写的转换
select * from emp;
select * from emp;
select trim(ename) from emp--去掉首尾的空格
select * from emp;
select * from emp where ENAME = 'KING'--从中查找某个指定的
select * from emp;
select sal,sal+300 from emp--使用数学运算符“+”
select sal,sal*10 from emp--使用数学运算符“*”
select sal,10*sal+300 from emp--运算符的优先级
select sal,10*(sal+300)from emp--带括好的运算
select * from emp;
select sal+20 AS sal_o from emp
select * from emp;
select ENAME || JOB from emp--连接符的运算
------数值函数-----
round--四舍五入
select round(412,-1) from dual--410
select round(412.777,2) from dual--412.78
trunc--截断
select trunc(412.13,-1) from dual--410
MOD --求余
select MOd(200,11) from emp
select Mod(135.23,15) from dual
--日期函数
Months_between()---两个日期相差的月数
select months_between(sysdate,hiredate) from emp
Last_day---本月的最后一天
select last_day(sysdate) from dual
Next_day()--指定日期的下个日期
select next_day(sysdate,'星期一') from dual
-------------------------------------------------
select * from emp order by sal DESC
select sal
from emp
order by sal DESC
--------------------------------------------------
Add_months()--向指定日期加上若干月数
select Add_months(sysdate,0) from dual;