Number Date Student Notes
Number Date Student Notes
numeric values ROUND(numericvalue,decimal places) ** if the rounding value is negative, start at the decimal moving left then place an "imaginary" decimal there and round. 45.926, 2 = 45.93 45.926, 1 = 45.9 45926, -2 = 45900 45926, -3 = 46000 TRUNC(numbericvalue, cut off at decimal place) **if the round decimal place value or the cut off at decimal place is omitted it is truncated to zero places ROUND/TRUNC(date,'MONTH') ROUND/TRUNC (date,'YEAR') SELECT last_name,hire_date, ROUND(hire_date,'MONTH'), TRUNC(hire_date,'MONTH') FROM employees WHERE last_name = 'King'; MOD(dividend, divisor) MOD(2443,34) MOD(salary,1.5) The purpose of the DUAL table and the need to specify an alias to display data: DATES(arithmetic with dates,round, truncate) DD-MON-YY is the default format stores in numeric format and stored the the database to the second. (pg3-17) date + number it is in days SELECT last_name, hire_date + 90 AS "Review" FROM employees; *is a value odd or even?
date - date SELECT SYSDATE - hire_date AS "Days Worked" FROM employees WHERE last_name = 'King';
***ADD THE ROUND/TRUNC FUNCTION TO ELIMINATE THE DECIMAL PLACES ***DIVIDE BY 365 to SHOW YEARS
MONTHS_BETWEEN SELECT MONTHS_BETWEEN (SYSDATE, hire_date) AS "Months" FROM employees WHERE last_name = 'King'; SELECT MONTHS_BETWEEN ('25-DEC-02', '25-DEC-01') AS "Months" FROM DUAL; ADD_MONTHS SELECT last_name, hire_date,ADD_MONTHS(hire_date,6)AS "Evaluation" FROM employees WHERE last_name = 'King'; SELECT ADD_MONTHS ('25-DEC-02', 5) AS "Months" FROM DUAL; NEXT_DAY SELECT NEXT_DAY('13-FEB-02','TUESDAY')AS "Back to School" FROM DUAL; LAST_DAY SELECT LAST_DAY('13-FEB-02')AS "Payday" FROM DUAL;