sql - how to create a new field to show, together with the SELECT'ed fields? -
these code lines filter of people on 50.
select birthday table_name birthday < now() - '50 years'::interval
together this, need create additional column, shows actual age.
es.
birthday age 2000-06-28 16
the column "age" shall created select. not present in table.
you can use specific function called age()
select extract(year age(birth_date)) age ...
https://www.postgresql.org/docs/9.5/static/functions-datetime.html
keep in mind: age
subtracts current_date (at midnight)
Comments
Post a Comment