ソースコード
WITH total AS 
(
 SELECT
  a.PF_CODE AS CODE,
  b.PF_NAME AS NAME,
  SUM(CAST(a.AMT AS FLOAT)) AS AMT
 FROM
  DRINK_HABITS AS a
 LEFT JOIN
  PREFECTURE AS b
 USING
  (PF_CODE)
 WHERE
  CATEGORY_CODE = '110'
 GROUP BY
  CODE,NAME
),
total_drink AS 
(
 SELECT
  a.PF_CODE AS CODE,
  b.PF_NAME AS NAME,
  SUM(CAST(a.AMT AS FLOAT)) AS AMT
 FROM
  DRINK_HABITS AS a
 LEFT JOIN
  PREFECTURE AS b
 USING
  (PF_CODE)
 WHERE
  CATEGORY_CODE = '120'
 GROUP BY
  CODE,NAME
)
SELECT
 a.CODE,
 a.NAME,
 ROUND(100*(b.AMT/a.AMT),1) AS PERCENTAGE
FROM
 total AS a
LEFT JOIN
 total_drink AS b
USING
 (CODE)
ORDER BY
 PERCENTAGE DESC,CODE
提出情報
提出日時2024/02/03 22:30:29
コンテスト第2回 SQLコンテスト
問題飲酒率
受験者romi0416
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量87 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
87 MB
データパターン2
WA
85 MB