【LeetCode】627. Swap Salary
来源:互联网 发布:linux windows传文件 编辑:程序博客网 时间:2024/05/21 09:20
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 query and no intermediate temp table.
| id | name | sex | salary ||----|------|-----|--------|| 1 | A | m | 2500 || 2 | B | f | 1500 || 3 | C | m | 5500 || 4 | D | f | 500 |After running your query, the above salary table should have the following rows:
| id | name | sex | salary ||----|------|-----|--------|| 1 | A | f | 2500 || 2 | B | m | 1500 || 3 | C | f | 5500 || 4 | D | m | 500 |也是简单的sql题目
但是。。我已经还给老师了,看了看答案。完成了AC。
# Write your MySQL query statement belowUpdate salary SET sex = CASE sex WHEN 'f' THEN 'm' ELSE 'f' END;
阅读全文
0 0
- [leetcode]627. Swap Salary
- 【LeetCode】627. Swap Salary
- 【leetcode】627. Swap Salary
- LeetCode-627. Swap Salary
- [LeetCode] 627.Swap Salary
- sql leetcode 627. Swap Salary
- 【LeetCode】627、Swap Salary
- 627. Swap Salary
- 627. Swap Salary
- 627. Swap Salary
- 627. Swap Salary
- 627.SWAP Salary
- LC 627. Swap Salary
- LeetCode——627. Swap Salary(数据库,sql)
- 627. Swap Salary--UPDATE and CASE...WHEN
- leetcode627. Swap Salary
- 8.leetCode627: Swap Salary
- 【LeetCode】Second Highest Salary && Nth Highest Salary
- Ajax工作原理以及同步与异步的区别
- 智慧城市的背后是大数据的深度挖掘和利用
- POJ_1142_Smith Numbers
- Android Studio开发App经常会用到的软件
- 用递归解决一些oj上的题(数塔)
- 【LeetCode】627. Swap Salary
- 对话框
- c++ substr函数
- 7.2 C控制语句:N以内所有素数判断并输出
- 7.5 C控制语句:简单统计单词的程序
- 7.5 C控制语句:条件运算符
- 7.5 C控制语句:循环辅助 continue
- 7.5 C控制语句:ctype.h系列的字符函数
- 运算符重载(C++)1