Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Exchange Seats

Swap the seat ids of every two consecutive students. If the number of students is odd the last student keeps their seat. Return the rows ordered by id.

Table schema

Seat(id INT PRIMARY KEY, student VARCHAR(20))

Sample data

id | student
1 | Abbot
2 | Doris
3 | Emerson
4 | Green
5 | Jeames

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.