一、sql实现相除保留2位小数
select * from A where round(A.count/A.last_count,2) > 0.25
二、sum函数返回为空,如何默认返回为0
select COALESCE(SUM(A.total),0) from A
三、获取多条数据中的第一条
select * from A where rownum = 1
四、替代case when then else的简单写法
select decode(u.sex,0,'未知',1,'男',2,'女') from users u
五、多条记录,转成1条逗号分隔的形式
select WMSYS.WM_CONCAT(u.id) from user u
六、获取两个时间的天数差
select trunc(sysdate)-trunc(create_time) from dual;
select to_date(trunc(sysdate)) - to_date(trunc(create_time)) from dual;