SQL sysdate

Sysdate

Sysdate: Sysdate is used to get the system date and time.This return values in format of "nls_date_time". Sysdate is a pseudo column.
 
SQL>SELECT sysdate FROM DUAL;
Note:-We can change the format of nls_date_time for session by below command.
SQL>ALTER SESSION SET nls_date_format='DD-MON-YYYY HH24:MI:SS';
Now you will get the result in above mentioned format.
SQL>SELECT sysdate FROM DUAL;
Below is expression list that can be used in different queries
 In many situation we need to use "sysdate" for getting the required result.

Exercise
Q 1:- Write a query for monthly report from transaction table
Q 2:- Write a query to retrieve the TPS (Transaction Per Second) from transaction Table
Q 3:- Write a query to delete data older than 180 days from transaction Table.
Q 4:- Write a query to retrieve data from 1st date of current month to 1 day before.
Q 5:- Write a query to retrieve data of employees who joined 5 year ago from current date.

No comments:

Post a Comment