Aim:
Explore the number and date functions using SQL queries.
Algorithm:
Step 1: Start the program.
Step 2: Create the dual.
Step 3: Explore the number and dual function in dual.
Step 4: Get the output.
Step 5: Stop the program.
NUMBER FUNCTIONS
select ABS(5) from DUAL;
select 1561.75 AS "NUMBER", CEIL(1561.75) from DUAL;
select FLOOR(4.43) from DUAL;
select ROUND(4.93) from DUAL;
select POWER(3,2) from DUAL;
select MOD(7,2) from DUAL;
select SIGN(-36),SIGN(0),SIGN(36) from DUAL;
DATE FUNCTION
select ADD_MONTHS(SYSDATE,4)"Add Months"from dual;
select SYSDATE,LAST_DAY(SYSDATE)"LastDay"from dual;
select MONTHS_BETWEEN('02-FEB-95','02-JAN-99')"Months"from dual;
select NEXT_DAY('10-AUG-19','Saturday')"NEXT DAY"from dual;
select ROUND(TO_DATE('01-JUL-19'),'YYYY')"Year"from dual;
select NEW_TIME(TO_DATE('2004/07/01 01:45','yyyy/mm/dd HH24:MI'),'AST','MST')"MST" from dual;
select TO_CHAR(SYSDATE,'DD-MM-YY')from dual;
select TO_DATE('06/07/02','DD/MM/YY')from dual;
Post a Comment