Search code examples
sqlwhere-clause

How to query for every manager born after certain date in WHERE clause - SQL


I have a table called 'managers' and in it is a column called 'birth_date' with the data type of DATE. I'm trying to query for every manager in my managers table who was born before 1973 with a WHERE clause. I thought this was the proper syntax, but it's not working:

SELECT birth_date FROM managers
WHERE birth_date < '1973'

Solution

  • 1973 is not a valid date, you must pass a valid format, e.g.

    SELECT birth_date 
    FROM managers
    WHERE birth_date < DATE('1973-01-01')