ソースコード
with rsv_status as(
select 
t1.line_id,
t1.seat_no,
case when
    t2.seat_no - t1.seat_no = 1 then t1.seat_no
    end as seat_f,
case when
    t3.seat_no - t1.seat_no = 2 then t3.seat_no end as seat_l
from seat_reserve as t1
left join seat_reserve as t2
on t1.line_id = t2.line_id
left join seat_reserve as t3
on t1.line_id = t3.line_id
where t1.rsv_status= '0'
and t2.rsv_status = '0'
and t3.rsv_status= '0')
select distinct
line_id as LINE,
seat_f as SEAT_F,
seat_l as SEAT_T
from rsv_status
where (seat_f is not null and seat_l is not null)
order by line desc,seat_f
提出情報
提出日時2024/06/24 10:30:05
コンテスト第13回 SQLコンテスト
問題空席検索
受験者sakichiii
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量84 MB
メッセージ
テストケース(通過数/総数)
3/3
状態
メモリ使用量
データパターン1
AC
84 MB
データパターン2
AC
84 MB
データパターン3
AC
83 MB