oracle函数笔记(1)

1.在数据库中显示当前时间:函数(sysdate)

select sysdate from dual

2.数据库中显示 :年/月/日 时/分/秒 ---函数:to_char(字段,'yyyy-mm-dd hh24:mm:ss')

select to_char(hiredate,'yyyy-mm-dd hh24:mm:ss') from emp;

3.查询oracle数据库中emp表入职时间大于8个月的---函数:add_months(hiredate,8)

select * from emp where sysdate > add_months(hiredate,8);

4.查询oracle数据库emp表入职时间是每月最后一天 ---函数:last_day(hiredate)

示例是查询在每月倒数第3天的数据:

select * from emp where hiredate=last_day(hiredate)-2

猜你喜欢

转载自www.cnblogs.com/AIHEN/p/9465640.html