CommencerCommencer gratuitement

Calculate the age

You are a data-driven journalist interested in an upcoming election. Two elected officials will be inducted into office on January 21, 2021. You want to know how old they will be on the day of their inauguration.

You know that as a journalist, you should express your answers in more relatable terms. You would like to have their age in terms of years, months, and days. You had the insight that you can do this calculation with PostgreSQL, without having to setup a special table.

Here is what your query would look like, but what function do you need to complete it?

SELECT ___('2021-01-21', birthday)
FROM birthdays;

Cet exercice fait partie du cours

Time Series Analysis in PostgreSQL

Afficher le cours

Exercice interactif pratique

Passez de la théorie à la pratique avec l’un de nos exercices interactifs

Commencer l’exercice