How do I compare dates in SQL?

In Microsoft SQL Server, MySQL, and I’m sure many other variations, you can use your regular =, >, <, >=, etc with datetime, date, time, and similar fields. These function we need to filter data or to use in specify join with conditions.

You may need to use a function to truncate (or round) the date or time portion if you are not concerned about minute and second accuracy.

Ex: select sal(col) from the employee (tab) where sal<=1000;