What happens Next Day??

NEXT_DAY

Syntax: NEXT_DAY (start date, day of the week)

Parameters: start date is the date parameter used to find the next weekday. Day of week may be a character value or integer value. Acceptable character values and Integer values are given in the table below along with description for each.

Return type: The NEXT_DAY function returns a date value.

Character value
Integer value
Description
SUNDAY
1
Date of the first Sunday greater than date
MONDAY
2
Date of the first Monday greater than date
TUESDAY
3
Date of the first Tuesday greater than date
WEDNESDAY
4
Date of the first Wednesday greater than date
THURSDAY
5
Date of the first Thursday greater than date
FRIDAY
6
Date of the first Friday greater than date
SATURDAY
7
Date of the first Saturday greater than date

Usage:
According to company's policy, every employee gets the JOINING BONUS on the first Friday after the joining day.  Company's database doesn't have information about the date on which each employee has got his/her JOINING BONUS. Manager needs this data for the reporting purpose.  She called Data analyst. Manager to Data analyst:  Bring me the list of all employees and the date on which each employee has got their JOINING BONUS. Data analyst runs below query to fetch the required data.

SELECT EMPLOYEE_ID, FIRST_NAME, LAST_NAME, NEXT_DAY (HIRE_DATE, 'FRI') AS JOINING_BONUS_DATE FROM EMPLOYEES;

Comments

Popular posts from this blog

Let's learn Left Outer Join!

Let's extract STRING!

Let's learn Cross Join!