LeetCode/Ritコード-Swap Salry-MySQL


質問する




に答える

  • write an sql query to swap all f and m values with a single update statement and no intermediate emp table(s).
  • note that you must write a single update statement, do not write any select statement for this problem.
  • the query result format is in the following example.
  • コード#コード#

    -- leetcode, Swap Salary, mysql
    UPDATE Salary
    SET sex = CASE WHEN sex = 'm' THEN 'f' ELSE 'm' END

    結果




    ソース&ハーブ


    leetcode
    github