ソースコード

SELECT
    PREF.PF_CODE AS CODE,
    PREF.PF_NAME AS NAME,
    ROUND((DRINK.AMT / POP.AMT)*100, 2) AS PERCENTAGE
FROM
    PREFECTURE AS PREF
INNER JOIN
    (
        SELECT  
            PF_CODE,
            AMT
        FROM
            DRINK_HABITS
        WHERE
            GENDER_CODE IN ('2','3')
        AND
            CATEGORY_CODE = '110'
        GROUP BY
        PF_CODE
    ) POP
ON PREF.PF_CODE = POP.PF_CODE
INNER JOIN
	(
		SELECT  
            PF_CODE,
            AMT
        FROM
            DRINK_HABITS
        WHERE
            GENDER_CODE IN ('2','3')
        AND
            CATEGORY_CODE = '120'
        GROUP BY
        PF_CODE
    ) DRINK
ON PREF.PF_CODE = DRINK.PF_CODE
ORDER BY
    ROUND((DRINK.AMT / POP.AMT)*100, 2) AS PERCENTAGE desc,
    PREF.PF_CODE asc
GROUP BY
    PREF.PF_CODE,
    PREF.PF_CODE
;
提出情報
提出日時2022/09/21 21:14:59
コンテスト第2回 SQLコンテスト
問題飲酒率
受験者MMpine
状態 (詳細)RE
(Runtime Error: 実行時エラー)
メモリ使用量103 MB
メッセージ
SQLITE_ERROR: near "AS": syntax error
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
RE
103 MB
データパターン2
RE
100 MB