排序
select * from emp order by sal desc; -- 工资倒序
select * from emp order by sal ; --默认正序
select * from emp order by sal desc,hiredate desc; --工资和入职日期倒序
select *from emp;
单行函数
select 1 from dual; --dual是伪表
select upper('smith') from dual; --把小写字符转换为大写字符
select lower('SMITH') from dual; --把大写字符转换为小写字符
select initcap('smith') from dual; --把首字母转换为大写
select concat('hello','world') from dual; --把hello和world连接起来
select 'hello' | | 'world' from dual; --同上 建议使用,可以跨平台
select substr('hello',1,4) from dual; --切割字符串
select length('hello') from dual; --计算字符串的长度
select replace('hello','l', 'x') from dual; --替换字符串中的字符把 ll 替换成 xx
select round(13.89) from dual; --四舍五入 等于14
select round(13.5678,3)from dual; --保留 3 位小数
select trunc(12.89) from dual; --去掉小数部分,不进行四舍五入 结果是12
select trunc(12.3465, 2) from dual; --只留下两位小数 不进行四舍五入结果是12.34
select mod(11,3)from dual;--取余数 结果是2