题目标签:

  题目给了我们一个 工资表格,让我们把 男女性别对换。

  这里可以利用IF, IF(conditionvalue_if_truevalue_if_false)。

Java Solution:

Runtime:  135 ms, faster than 94.04%

Memory Usage: N/A

完成日期:07/02/2019

关键点:IF(conditionvalue_if_truevalue_if_false)

# Write your MySQL query statement below
UPDATE salary
SET sex = IF(sex = 'm', 'f', 'm');

参考资料:LeetCode Discuss

LeetCode 题目列表 - LeetCode Questions List

题目来源:https://leetcode.com/

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 数据库带判断的更新操作

    https://leetcode.com/problems/swap-salary/description/ 用  set keyWord = Case depentedWord when haha ...

  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. [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 ...

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

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

  6. case when then的用法-leetcode交换工资

    case具有两种格式:简单case函数和case搜索函数. --简单case函数 case sex when ' then '男' when ' then '女’ else '其他' end --ca ...

  7. Linux命令 swap:内存交换空间

    swap 内存交换空间的概念 swap使用上的限制

  8. [SQL]LeetCode627. 交换工资 | Swap Salary

    SQL架构 create table ), sex ), salary int) Truncate table salary insert into salary (id, name, sex, sa ...

  9. LeetCode:627.交换工资

    题目链接:https://leetcode-cn.com/problems/swap-salary/ 题目 给定一个 salary 表,如下所示,有 m = 男性 和 f = 女性 的值.交换所有的 ...

随机推荐

  1. http://elasticsearch-py.readthedocs.io/en/master/api.html

    API Documentation All the API calls map the raw REST api as closely as possible, including the disti ...

  2. 【SQL】语句/函数汇总

    1.CHARINDEX(短字符A,长字符B) 说明:返回A在B的位置,从1开始,若B中不存在A,则为0 例如: SELECT CHARINDEX('aaaa','abaaaacded')  ----- ...

  3. VS2010 下C++使用UTF8编码

    http://www.nubaria.com/en/blog/?p=289 #pragma execution_character_set("utf-8")

  4. 引入scss(@import)和其中易错点

    1.引入文件方式 @import 'url'; ./ :当前目录 ../ :上级目录 src/api/styles: 绝对路径 2.一般在main.js中引用当做全局样式 import 'styles ...

  5. ActionContext 与 ServletActionContext获取Session的异同

    1. ActionContext 在Struts2开发中,除了将请求参数自动设置到Action的字段中,我们往往也需要在Action里直接获取请求(Request)或会话(Session)的一些信息, ...

  6. jquery 弥补ie6不支持input:hover状态

    <!doctype html><html>    <head>    <meta charset="utf-8">    <t ...

  7. UI自动化ADB出现devices offline的解决方法

    终端运行如下命令即可解决: adb kill-server adb start-server adb remount

  8. 高级UI晋升之布局ViewGroup(四)

    更多Android高级架构进阶视频学习请点击:https://space.bilibili.com/474380680本篇文章将从LinearLayout.RelativeLayout.FrameLa ...

  9. 40-Ubuntu-用户管理-05-which查看命令所在位置

    which 查看执行命令所在的位置 例: 1.查看修改用户密码的命令--passwd所在位置 which passwd 注: /etc/passwd 是用于保存用户信息的文本文件. /usr/bin/ ...

  10. USACO2007 The Bale Tower /// DFS oj21160

    题目大意: 给出N个捆包,每个捆包有相应的长度和宽度,要求堆叠捆包,使下方的捆包长宽永远大于上方的捆包的长宽. Input Multiple test case. For each case: * L ...