ソースコード
SELECT 
  a.PF_CODE as CODE,
  a.PF_NAME  as NAME, 
  round(cast(b.NONDERUHITO_AMT as REAL)/cast(c.SUM_AMT as REAL)*100,2) as PERCENTAGE
FROM
  PREFECTURE as a
INNER JOIN 
  (SELECT 
     PF_CODE,
     SUM(AMT) as NONDERUHITO_AMT
   FROM 
     DRINK_HABITS
   WHERE
     CATEGORY_CODE = '120' 
     AND GENDER_CODE in ('2','3')
   GROUP BY
     PF_CODE
   ) as b
INNER JOIN 
  (SELECT 
     PF_CODE,
     SUM(AMT) as SUM_AMT
   FROM 
     DRINK_HABITS
   WHERE
     GENDER_CODE in ('2','3')
   GROUP BY
     PF_CODE
   ) as c
ON
  a.PF_CODE = b.PF_CODE
  and a.PF_CODE = c.PF_CODE
ORDER BY
  PERCENTAGE DESC,
  CODE DESC
提出情報
提出日時2024/12/04 19:07:06
コンテスト第2回 SQLコンテスト
問題飲酒率
受験者urayamari
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量88 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
88 MB
データパターン2
WA
85 MB