I have a dataset with name and date of birth of some people, and I want to calculate their age! I helped to form the query (for BigQuery) to obtain this result? thanks
1 Answer
That should be easy for BigQuery, a lot depends on how you are storing the date of birth.
Let's say it's a string, on the form '2005-10-01'. One way to get ages is:
SELECT INTEGER(
(NOW() - (TIMESTAMP(CONCAT(birthdate, ' 00:00:00'))))
/ 24/3600/365/1000/1000)
FROM users
1 Comment
Gilberto Torrezan
How does this deal with leap years?