Leetcode学习笔记:#627. Swap Salary

Leetcode学习笔记:#627. Swap Salary

Given a table salary, such as the one below, that has m=male and f=female values. Swap all f and m values (i.e., change all f values to m and vice versa) with a single update statement and no intermediate temp table.

Note that you must write a single update statement, DO NOT write any select statement for this problem.

实现:

UPDATE salary SET sex = IF(sex = 'm', 'f', 'm')

猜你喜欢

转载自blog.csdn.net/ccystewart/article/details/90178667