ソースコード
SELECT
distinct
DR.PF_CODE AS CODE,
PR .PF_NAME AS NAME,
ROUND( CAST(DR2.AMT2 AS REAL) / CAST(DR1.AMT1 AS REAL) * 100 ,1)  AS PERCENTAGE
FROM DRINK_HABITS DR
INNER JOIN PREFECTURE AS PR 
ON DR.PF_CODE = PR .PF_CODE
LEFT OUTER JOIN (select PF_CODE,sum(AMT) as AMT1 from DRINK_HABITS where CATEGORY_CODE = '110'group by PF_CODE) DR1  ON DR.PF_CODE = DR1.PF_CODE
LEFT OUTER JOIN (select PF_CODE,sum(AMT) as AMT2 from DRINK_HABITS where CATEGORY_CODE = '120' and (GENDER_CODE = '2' or GENDER_CODE = '3')  group by PF_CODE) DR2  ON DR.PF_CODE = DR2.PF_CODE
group by CODE,NAME,PERCENTAGE
ORDER BY PERCENTAGE DESC, DR.PF_CODE ASC;
提出情報
提出日時2022/09/21 22:02:26
コンテスト第2回 SQLコンテスト
問題飲酒率
受験者ksw1843
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量94 MB
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
WA
83 MB
データパターン2
AC
94 MB