My Database has a table named "employee" and "hire_date" column in it. I tried to fire following Query, but got empty set:
mysql> SELECT * from employees
-> WHERE hire_date < 1989-11-21;
Empty set, 1 warning (0.00 sec)
Though I have records with hire_date before 21 NOV 1989. Can anyone help me out?
Date literals in MySQL typically require single quotes, so use:
SELECT *
FROM employees
WHERE hire_date < '1989-11-21';
Note that this assumes that your hire_date
column be actually date or datetime, or, if text, that you are storing your text dates in YYYY-MM-DD
format.