SQL SELECT DATE

SQL SELECT DATE is used to retrieve date from the database. If you want to check any date from any database, you can use this statement. 

SQL SELECT DATE Syntax

Let’s see an example where we want to get all the records after ‘2018-12-12’.

SELECT * FROM 
table_name WHERE date_column >= '2018-12-12';

Let’s check another example where we want to get all the records after ‘2018-12-12’ and before ‘2019-12-12’.

SELECT * FROM 
table_name WHERE date_column >= '2018-12-12' and date_column<'2019-12-12';

The above query also can be written using BETWEEN operator. The BETWEEN operator select date range in a database.

SELECT * FROM 
table_name WHERE date_column BETWEEN '2018-12-12' and '2019-12-12';

If you are looking for one perticuler date, you should change the date parameter into the acceptable form. 

SELECT* FROM 
table_name WHERE cast (datediff (day, 0, date_column) as datetime) = '2018-12-12';

Summary: In this tutorial, you have learned how to use SQL SELECT DATE to get date from a database.