您的位置:首页 > 数据库 > Oracle

oracle函数笔记(1)

2020-03-02 00:54 716 查看

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

 

转载于:https://www.cnblogs.com/AIHEN/p/9465640.html

  • 点赞
  • 收藏
  • 分享
  • 文章举报
dinghongwei55555 发布了0 篇原创文章 · 获赞 0 · 访问量 129 私信 关注
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: