解答

123

SQL文(クエリ)

SELECT
  CASE
    WHEN prefecture IN("東京", "千葉", "埼玉", "神奈川") THEN "一都三県"
    ELSE "一都三県以外"
  END AS pref_category
  , AVG(DATE_DIFF("2019-12-31", birthday, YEAR)) AS avg_age
  , STDDEV_POP(DATE_DIFF("2019-12-31", birthday, YEAR)) AS stddev_age
FROM
  sample.customers
GROUP BY
  pref_category

結果テーブル

結果テーブル

サポートページに戻る