https://leetcode.com/problems/swap-salary/description/

用  set keyWord = Case depentedWord

when haha then baba

else lala

end

最后需要end

# Write your MySQL query statement below
update salary
set sex = case sex
when 'm' then 'f'
else 'm'
end;

leetcode 627. Swap Salary 数据库带判断的更新操作的更多相关文章

  1. 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 v ...

  2. LeetCode 627. Swap Salary (交换工资)

    题目标签: 题目给了我们一个 工资表格,让我们把 男女性别对换. 这里可以利用IF, IF(condition, value_if_true, value_if_false). Java Soluti ...

  3. 627. Swap Salary

    627. Swap Salary SQL Schema Given a table salary, such as the one below, that has m=male and f=femal ...

  4. 对oracle数据库进行增删改更新操作,executeUpdate()执行卡住了

    原因是:oracle数据库更新数据后需要commit,不然会堵塞,就会卡住 那么每次调用executeUpdate()完后,数据库要自动commit才可以. 我的基类加了一下,注意红色字体部分代码: ...

  5. [LeetCode] 627. Swap Salary_Easy tag: SQL

    Given a table salary, such as the one below, that has m=male and f=female values. Swap all f and m v ...

  6. [LeetCode] Department Highest Salary -- 数据库知识(mysql)

    184. Department Highest Salary The Employee table holds all employees. Every employee has an Id, a s ...

  7. mybatis+oracle 批量插入,若数据库中有则做更新操作

    1.只批量插入: insert into WXPAY_ACCOUNT(id ,out_trade_no ,transaction_id)select SEQ_WXPAY_ACCOUNT.nextval ...

  8. SQL语句中IF的简单使用 - 关联leetcode 627.交换工资

    MySQL的IF既可以作为表达式用,也可在存储过程中作为流程控制语句使用,如下是做为表达式使用: IF表达式 IF(expr1,expr2,expr3) 如果 expr1 是TRUE (expr1 & ...

  9. [LeetCode] Department Highest Salary 系里最高薪水

    The Employee table holds all employees. Every employee has an Id, a salary, and there is also a colu ...

随机推荐

  1. 关于css js文件缓存问题

    什么情况下,要禁止静态文件缓存:1.经常可能要改动的 js, css.比如一个js文件引用如下<script src="test.js"></script> ...

  2. Windows下启动redis错误1067:进程意外中止

    已解决: 在redis-64.3.0.503文件夹下新建一个空文件夹,命名为logs,如下图所示: 最后成功了 开启服务:redis-server --service-start

  3. MVC小记备忘

    1,页面用<dl><dt><dd>和Bootstrap的"dl-horizontal"类布局页面,使每一个属性名和属性值占一行 <dl c ...

  4. C#面向对象之三大特性: 封装

    学到封装就会想到访问修饰符,说到访问修饰符,就会想到访问等级,或者说是访问能力的大小.当然也少不了默认的访问类型. C# 方法默认访问级别 : private (私有的) C# 类默认访问级别 : i ...

  5. vtk-py z-Buffer可见算法

    C++版例子: https://lorensen.github.io/VTKExamples/site/Cxx/PolyData/SelectVisiblePoints/ 优点: Simple to ...

  6. 关于Unity中的UGUI优化,你可能遇到这些问题

    https://blog.uwa4d.com/archives/QA_UGUI-1.html 关于Unity中的UGUI优化,你可能遇到这些问题 作者:admin / 时间:2016年11月08日 / ...

  7. WebForm与MVC混用 (转)

    http://blog.csdn.net/leftfist/article/details/11591231

  8. Windows Server上用命令来起停IIS站点

    平时,在Server上管理IIS,都是在界面上进行一些配置,然后再做一些start和stop操作... 对于配置的人来说,会做一些重复步骤,所以适当的使用命令,能大大提高效率. 下面命令是自己之前使用 ...

  9. (16)break和continue

    #(1)这里顺带说下pass # pass 过 的意思,防止代码报错,就是个占位的, if True: # 不允许代码块里面的内容为空,用pass占位 pass #(2)break (只能用在循环当中 ...

  10. CodeForces - 476B -Dreamoon and WiFi(DFS+概率思维)

    Dreamoon is standing at the position 0 on a number line. Drazil is sending a list of commands throug ...