ソースコード
SELECT
 d.PF_CODE as CODE
 ,p.PF_NAME as NAME
 , SUBSTRING((ROUND((CAST(d.amtx as REAL)/CAST(d.amty as REAL))*100,1) || '0'),1, (length(ROUND((CAST(d.amtx as REAL)/CAST(d.amty as REAL))*100,1) || '0')-1)) as PERCENTAGE
FROM
 (
 SELECT
  x.PF_CODE
  ,x.amtx
  ,y.amty
 FROM 
  (
  select PF_CODE, SUM(AMT) as amtx
  from DRINK_HABITS
  where CATEGORY_CODE = '120' AND GENDER_CODE in ('2','3')
  group by PF_CODE
  ) x
  inner join
  (
  select PF_CODE, SUM(AMT) as amty
  from DRINK_HABITS
  group by PF_CODE
  ) y
 ) d
 INNER JOIN
 PREFECTURE p
 ON d.PF_CODE = p.PF_CODE
ORDER BY
 PERCENTAGE desc, d.PF_CODE desc
提出情報
提出日時2022/09/21 16:25:03
コンテスト第2回 SQLコンテスト
問題飲酒率
受験者na1216
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量96 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
96 MB
データパターン2
WA
96 MB