I have the following table:
CREATE TABLE public.employees
(
employee_id integer NOT NULL,
name text NOT NULL,
date_of_birth date,
address text,
email text,
C
Use date_part() and age() functions
SELECT name text, date_part('year',age(date_of_birth)),* FROM public.employees
See for documentation of date functions https://www.postgresql.org/docs/current/static/functions-datetime.html
you can use age() function like this :
SELECT name, EXTRACT(year FROM age(current_date,date_of_birth)) :: int as age FROM public.employees