高频 SQL 50 题(基础版)_626. 换座位
select(case when mod(id,2)!=0 AND counts != id then id+1when mod(id,2)!=0 AND counts = id then idelse id -1end) as id,student
fromseat,(selectcount(*) as countsfrom seat) as seat_counts
order by id asc;
select(case when mod(id,2)!=0 AND counts != id then id+1when mod(id,2)!=0 AND counts = id then idelse id -1end) as id,student
fromseat,(selectcount(*) as countsfrom seat) as seat_counts
order by id asc;