ソースコード
with with_code as (
    select distinct
        FIRST_VALUE(CLASS_NAME ) OVER(PARTITION BY CLASS_CODE ORDER BY AMT DESC RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) as CLASS
      , FIRST_VALUE(CLASS_CODE ) OVER(PARTITION BY CLASS_CODE ORDER BY AMT DESC RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) as CLASS_CODE
      , FIRST_VALUE(PERSON_NAME) OVER(PARTITION BY CLASS_CODE ORDER BY AMT DESC RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) as PERSON
      , FIRST_VALUE(AMT        ) OVER(PARTITION BY CLASS_CODE ORDER BY AMT DESC RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) as HOUSEHOLDS
    from
        HOUSEHOLD
    where
        not PERSON_CODE = '1'
    and not CLASS_CODE  = '01'
)
select
    CLASS
  , PERSON
  , HOUSEHOLDS
from
    with_code
order by
    CLASS_CODE asc
提出情報
提出日時2022/10/19 19:41:33
コンテスト第3回 SQLコンテスト
問題最大世帯人員
受験者kamaoda
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量92 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
90 MB
データパターン2
AC
92 MB