BigQueryで誕生日から年齢を計算する方法
DATE_DIFFを使う方法
今日の日付から年齢を計算
SELECT
DATE_DIFF(CURRENT_DATE(), birthday, YEAR) AS age
FROM customers
特定の日付から年齢を計算
SELECT
DATE_DIFF(DATE "2019-12-31", birthday, YEAR) AS age
FROM customers
CASTとFORMAT_DATEとFLOORを使う方法
SELECT
CAST((CAST(FORMAT_DATE('%Y%m%d', CURRENT_DATE()) AS INT64) - CAST(FORMAT_DATE('%Y%m%d', birthday ) AS INT64)) / 10000 AS int64) AS current_age
FROM customers