解答

184

SQL文(クエリ)

SELECT
  user_id
  , DATE_DIFF("2019-12-31", birthday, YEAR) AS age
FROM
  sample.customers
WHERE
  DATE_DIFF("2019-12-31", birthday, YEAR) > (
    SELECT
      AVG(DATE_DIFF("2019-12-31", birthday, YEAR)) AS avg_age
    FROM
      sample.customers
  )
AND register_date IS NOT NULL
ORDER BY
  register_date
LIMIT 3

結果テーブル

結果テーブル

サポートページに戻る