Dark Mode
Image

SQL Tutorial

SQL Database

SQL Injection

PL/SQL Tutorial

Sql Interview Question

SQl Quiz

SQL SELECT DATE

SQL SELECT DATE is used to retrieve a date from a database. If you want to find a particular date from a database, you can use this statement.

For example: let's see the query to get all the records after '2013-12-12'.

SELECT * FROM   
table-name WHERE your date-column >= '2013-12-12' 

Let's see the another query to get all the records after '2013-12-12' and before '2013-12-13' date.

SELECT* FROM   
table-name where your date-column < '2013-12-13' and your date-column >= '2013-12-12' 

If you want to compare the dates within the query, you should use BETWEEN operator to compare the dates.

SELECT * FROM   
table_name WHERE yourdate BETWEEN '2012-12-12' and '2013-12-12'

Or if you are looking for one date in particular you can use. You should change the date parameter into the acceptable form.

SELECT* FROM   
table_name WHERE cast (datediff (day, 0, yourdate) as datetime) = '2012-12-12'

 

Comment / Reply From