select a.hiredate 雇用日期,
a.hiredate + 5 加5天,
a.hiredate - 5 减5天,
add_months(hiredate, 5) 加5个月,
add_months(hiredate, -5) 减5个月,
add_months(hiredate, 5 * 12) 加5年,
add_months(hiredate, -5 * 12) 减5年
from emp a where rownum <=1;
雇用日期 加5天 减5天 加5个月 减5个月 加5年 减5年
----------- ----------- ----------- ----------- ----------- ----------- -----------
1980-12-17 1980-12-22 1980-12-12 1981-05-17 1980-07-17 1985-12-17 1975-12-17
select a.hiredate,
a.hiredate - 5 / 24 / 60 / 60 减5秒,
a.hiredate + 5 / 24 / 60 / 60 加5秒,
a.hiredate - 5 / 24 / 60 减5分钟,
a.hiredate + 5 / 24 / 60 加5分钟,
a.hiredate - 5 / 24 减5小时,
a.hiredate + 5 / 24 加5小时
from emp a
where rownum <= 1;
SQL> select duration,
duration * 24 间隔小时,
duration * 24 * 60 间隔分钟,
duration * 24 * 60 * 60 间隔秒
from (select (max(a.hiredate) - min(a.hiredate)) as duration from emp a where
a.ename in ('ALLEN', 'WARD')) x;
DURATION 间隔小时 间隔分钟 间隔秒
---------- ---------- ---------- ----------
2 48 2880 172800
select max_hd - min_hd 间隔天,
months_between(max_hd, min_hd) 间隔月,
months_between(max_hd, min_hd) /12 间隔年
from (select min(hiredate) min_hd, max(hiredate) max_hd from emp) x;
间隔天 间隔月 间隔年
---------- ---------- ----------
2348 77.1935483 6.43279569
with x as
(select level lvl
from dual
connect by level <=
(add_months(trunc(sysdate, 'y'), 12) - trunc(sysdate, 'y')))
select to_char(trunc(sysdate, 'y') + lvl - 1, 'DAY'), count(*)
from x
group by to_char(trunc(sysdate, 'y') + lvl - 1, 'DAY');
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有