ソースコード
SELECT
    T01.PF_CODE AS CODE
  , T00.PF_NAME AS NAME
  , ROUND(cast((T02.SUM_飲酒*100)as real)/cast(T01.SUM_総数 as real), 1) AS PERCENTAGE
FROM
    PREFECTURE T00
, 
(
SELECT
    PF_CODE
  , CATEGORY_CODE
  , SUM(AMT) AS SUM_総数
FROM
    DRINK_HABITS
WHERE
    GENDER_CODE IN ("2","3")
AND CATEGORY_CODE = "110"
GROUP BY
    PF_CODE
  , CATEGORY_CODE
) T01
, (
SELECT
    PF_CODE
  , CATEGORY_CODE
  , SUM(AMT) AS SUM_飲酒
FROM
    DRINK_HABITS
WHERE
    GENDER_CODE IN ("2","3")
AND CATEGORY_CODE = "120"
GROUP BY
    PF_CODE
  , CATEGORY_CODE
) T02
WHERE
    T01.PF_CODE = T02.PF_CODE
AND T01.PF_CODE = T00.PF_CODE
ORDER BY
    PERCENTAGE DESC
  , CODE DESC
提出情報
提出日時2022/09/21 23:14:01
コンテスト第2回 SQLコンテスト
問題飲酒率
受験者39ak
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量104 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
104 MB
データパターン2
AC
92 MB