SQL: Exchange Seats

Medium
SQL — Advanced SQL CASE WHEN MOD
Swap consecutive seat IDs.

Constraints

Write standard SQL (MySQL 8.0 compatible).

Examples

Example 1:
Input: 1 Ahmed 2 Sara 3 Omar
Output:
Example 2:
Input: 1 Ahmed 2 Sara 3 Omar
Output:

Hints

CASE WHEN with MOD.
▲ Console

Install Talent Arabia

Get instant access to jobs and career tools on your device.