Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (55.6k points)

Can anyone tell me how to compare two dates in SQL?

1 Answer

0 votes
by (119k points)

We can compare two dates using equals to, less than, and greater than operators in SQL. Here are the examples comparing dates in SQL:

If you want to find the employees joined on April 28th, 2020 from employee table:

SELECT E_id, E_name from Employee where join_date = ‘2020-04-28’;

You can use the less than and greater than operators in a similar way.

Here is the statement to find employees who joined between March 28th, 2020 and April 28th, 2020:

SELECT E_id, E_name from Employee where join_date between ‘2020-03-28’ and ‘2020-04-28’;

You can master these queries and become proficient in SQL queries by enrolling in an industry-recognized SQL certification.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked May 6, 2020 in SQL by Sudhir_1997 (55.6k points)
0 votes
1 answer
asked Apr 29, 2020 in SQL by Sudhir_1997 (55.6k points)
0 votes
1 answer

Browse Categories

...