How can I create select to show only the employees of a company that have been admitted to it before a given year?
The type yearAdmission is date ie: dd-mm-AA
SELECT * FROM Tfuncionario where EXTRACT (YEAR FROM anoAdmissao) < '2000'
The extract function was used to select only the year from the yearAdmission field, and then compare it to the desired year.
Simple like this:
select * from tfuncionario where anoAdmissao < to_char('2000/01/01', 'yyyy/mm/dd');
using to_char
to format a mask.
where '2000/01/01'
matches the given question period
I got it with this snippet of code:
select *
from tfuncionario F
where F.ANOADMISSAO <= ('01/01/00');