0626. Exchange Seats
https://leetcode.com/problems/exchange-seats
Description
Mary is a teacher in a middle school and she has a table seat
storing students' names and their corresponding seat ids.
The column id is continuous increment.
Mary wants to change seats for the adjacent students.
Can you write a SQL query to output the result for Mary?
For the sample input, the output is:
Note:
If the number of students is odd, there is no need to change the last one's seat.
ac
Last updated