SQL · Snapchat · Medium
Problem Write a SQL query for the Seats table that exchanges the occupants of every neighboring pair of seat numbers. Seat 1 trades with seat 2, seat 3 trades with seat 4, and so on. If the table has an odd number of seats, the final seat has no partner and remains unchanged. Return the complete table with the same columns, ordered by id. Table Schema id identifies the seat number. Each seat number is unique and positive. student stores the occupant assigned to that seat.…
Checking your access…