vendredi 29 mai 2015

SELECT age and earliest date from table query

 CREATE TABLE funcionario
  ( 
   idFuncionario    varchar2(5) not null,
   nome varchar2(50)    not null,
   remuneracao  varchar2(10)    not null,
   id   varchar2(5) not null,
   datanasc date    not null,
   morada   varchar(50) not null,
   tipoFuncionario varchar(20),
   idDepartamento   varchar2(5) REFERENCES departamento(idDepartamento),

   CONSTRAINT funcionario_pk PRIMARY KEY (idFuncionario)
 );

Hello there, I have this table and I want to find the earliest date and the age from every client (another table). I've tried this: SELECT nome, remuneracao, max(dataNasc) from funcionario

and it actually prints the min date but I think it orders it by using the day and not the year. For the age I'm struggling and I can't really figure that out.

Any ideas?

Thank you very much in advance

Kinda regards

Aucun commentaire:

Enregistrer un commentaire