DATE Arithmetic Difference between the dates

For Complete YouTube Video: Click Here

In this class, we will understand the DATE Arithmetic Difference between the dates.

We have already discussed some concepts on date functions.

DATE Arithmetic Difference between the dates

In SQL, we can find the difference between the dates.

What is the use of finding the difference between the dates?

If we find the difference between the dates, we will get the number of days.

For example, we have two dates, 16-JAN-2021 and 13-JAN-2021, we will get three days as the output.

Example on Date Difference

To understand this, we will consider the table below.

DATE Arithmetic Difference between the dates 1
DATE Arithmetic Difference between the dates 1

In the above table, we have the festival details with the start date and end date.

If we want to get the number of holidays, we have to find the difference between the start and end dates.

The query and the output of the ‘query’ are as shown below.

DATE Arithmetic Difference between the dates 2
DATE Arithmetic Difference between the dates 2

To understand more about the date difference, we will find the age of the employees.

The query and the output of the ‘query’ are as shown below.

DATE Arithmetic Difference between the dates 3
DATE Arithmetic Difference between the date