LoslegenKostenlos loslegen

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;

Diese Übung ist Teil des Kurses

Time Series Analysis in PostgreSQL

Kurs anzeigen

Interaktive Übung

Setze die Theorie in einer unserer interaktiven Übungen in die Praxis um

Übung starten