My LeetCode grinding. Trying to do a problem a day.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

problem.txt 779B

123456789101112131415161718192021222324
  1. 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.
  2. Note that you must write a single update statement, DO NOT write any select statement for this problem.
  3. Example:
  4. | id | name | sex | salary |
  5. |----|------|-----|--------|
  6. | 1 | A | m | 2500 |
  7. | 2 | B | f | 1500 |
  8. | 3 | C | m | 5500 |
  9. | 4 | D | f | 500 |
  10. After running your update statement, the above salary table should have the following rows:
  11. | id | name | sex | salary |
  12. |----|------|-----|--------|
  13. | 1 | A | f | 2500 |
  14. | 2 | B | m | 1500 |
  15. | 3 | C | f | 5500 |
  16. | 4 | D | m | 500 |