All Downloads are FREE. Search and download functionalities are using the official Maven repository.

g0601_0700.s0626_exchange_seats.script.sql Maven / Gradle / Ivy

There is a newer version: 1.35
Show newest version
# Write your MySQL query statement below
# #Medium #Database #2022_03_21_Time_274_ms_(65.75%)_Space_0B_(100.00%)
select
    id,
    case when id % 2 = 1 and lead(student) over (order by id) is null then student 
         when id % 2 = 1 then lead(student) over (order by id)
         else lag(student) over (order by id)
    end as student
from seat
order by id asc




© 2015 - 2024 Weber Informatics LLC | Privacy Policy