Get date before 2000 MySql

Posted on

Question :

I need to select all employees with a contracted date prior to the year 2000. How can I put this condition in the Where clause?

SELECT nome_funcionario FROM funcionario WHERE data_contratacao...

    

Answer :

I would do it differently, using the YEAR() function.

SELECT nome_funcionario FROM funcionario WHERE YEAR(data_contratacao) < 2000

    

SELECT nome_funcionario FROM funcionario WHERE data_contratacao < '2000-01-01'

    

Leave a Reply

Your email address will not be published. Required fields are marked *