here is SQL code


  • 0
    W
    SELECT
      (CASE
          WHEN id%2 = 0 THEN id-1
          WHEN id%2 = 1
        AND id <> (
        SELECT
          COUNT(*)
        FROM
          seat) THEN id+1
          ELSE id END) AS id,
      student
    FROM
      seat
    ORDER BY
      id ASC;
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.