select sysdate from dual

select * from dual

alter session set nls_date_format='DD-MON-YY';



select (sysdate - to_date('02/25/1989'))/365 from dual // 몇년 살앗니


select months_between(sysdate,to_date('02/25/1989'))/12 from dual //몇달 살앗니


select add_months(sysdate,3) from dual //3달 더하기


select next_day(sysdate, 'mon') from dual //다가오는 월요일


select last_day(sysdate) from dual // 이번달 마지막


select round(sysdate, 'year') from dual //년도 반올림 6월이후기 때문에 15년이됨




select 

   round(sysdate, 'YYYY') 

               "년-6월이후",

   round(sysdate, 'MM') 

               "월-16일이후",

   round(sysdate, 'DD') 

               "일-12이후",

   round(sysdate, 'day') 

               주-수요일이후,

   trunc(sysdate, 'YYYY') t1,

   trunc(sysdate, 'MM') t2,

   trunc(sysdate, 'DD') t3,

   trunc(sysdate, 'day') t4

 from dual;



'Computer > DB' 카테고리의 다른 글

SQL Insert select update delete  (0) 2014.09.01
SQL hr 계정 풀기  (0) 2014.09.01
SQL Injection 방어기법  (0) 2014.08.21
SQL 원격 데이터베이스 접속  (0) 2014.08.13
SQL Group by  (0) 2014.08.13

+ Recent posts