Last Day is always fun!!



LAST_DAY

Syntax: LAST_DAY (start date)

Parameters: Start date is the date value which is used to calculate last day of the month.

Return type: The LAST_DAY function returns date value.

Usage:
According to company’s policy, each employee gets the salary on the first day of every month. HR Manager wants date on which each employee has got his/her first salary. Manager to Data analyst: Bring me the list of all employees and the date on which they have got their first salary.

Data analyst runs below query to fetch the required data.

SELECT EMPLOYEE_ID, FIRST_NAME, LAST_NAME, LAST_DAY(HIRE_DATE)+1 AS FIRST_SALARY_DATE FROM EMPLOYEES; 




Comments

Popular posts from this blog

Let's learn Left Outer Join!

Let's extract STRING!

Let's learn Cross Join!