A teacher wants to swap every pair of neighboring students: seat 1 with seat 2, seat 3 with seat 4, and so on. Seat ids run from 1 with no gaps. If the number of students is odd, the student in the last seat stays where they are. Write an SQL query that returns id and student after the swap. Order the results by id ascending.
Loading…
Try solving the question with the schema explorer and hints first. When ready, reveal the verified canonical query and step-by-step logic breakdown.
Ask questions, share alternate queries, and explore solutions
Your recent query executions and answer checks
This will insert the verified MySQL solution into your editor so you can study how each clause transforms the table.