ソースコード
select SUM(AMT) from DRINK_HABITS;

select d.PF_CODE As CODE, p.PF_NAME As NAME , (SUM(d.AMT) / s.SOU) * 100 As PERCENTAGE
FROM DRINK_HABITS As d, PREFECTURE As p
, (select SUM(AMT) As SOU from DRINK_HABITS) As s
WHERE p.PF_CODE = d.PF_CODE
AND d.CATEGORY_CODE = '120'
AND d.GENDER_CODE IN ('2','3')
Group by CODE, NAME;

select CODE, NAME, SUM(PERCENTAGE1/SOU)*100 As PERCENTAGE from (
select d.PF_CODE As CODE, p.PF_NAME As NAME , SUM(d.AMT) As PERCENTAGE1, SOU
FROM DRINK_HABITS As d, PREFECTURE As p
, (select SUM(AMT) As SOU from DRINK_HABITS) As s
WHERE p.PF_CODE = d.PF_CODE
AND d.CATEGORY_CODE = '120'
AND d.GENDER_CODE IN ('2','3')
Group by CODE, NAME)
Group by CODE, NAME
ORDER BY PERCENTAGE DESC ,CODE DESC ;


提出情報
提出日時2022/09/22 10:50:22
コンテスト第2回 SQLコンテスト
問題飲酒率
受験者nasu
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量103 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
89 MB
データパターン2
WA
103 MB