ソースコード
SELECT CLASS_NAME AS CLASS
       ,PERSON_NAME AS PERSON
       ,MAX(AMT) AS HOUSEHOLDS
       
FROM HOUSEHOLD

WHERE 0=0
AND PERSON_CODE <> '1'
AND CLASS_CODE <> '01'

GROUP BY CLASS_CODE
        
ORDER BY CLASS_CODE ASC;

SELECT a.CLASS_NAME AS CLASS
       ,a.PERSON_NAME AS PERSON
       ,AMT AS HOUSEHOLDS
       
FROM (
      SELECT *
            ,row_number() over (partition by CLASS_CODE order by AMT desc) as c
      FROM HOUSEHOLD
      WHERE 0=0
        AND PERSON_CODE <> '1'
        AND CLASS_CODE <> '01'
        ) as a
WHERE a.c = 1

        
ORDER BY CLASS_CODE ASC;

提出情報
提出日時2022/10/19 21:51:41
コンテスト第3回 SQLコンテスト
問題最大世帯人員
受験者123548827225579
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量95 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
95 MB
データパターン2
AC
95 MB