LeetCode 627. Swap Salary (交换工资)
题目标签:
题目给了我们一个 工资表格,让我们把 男女性别对换。
这里可以利用IF, IF(condition, value_if_true, value_if_false)。
Java Solution:
Runtime: 135 ms, faster than 94.04%
Memory Usage: N/A
完成日期:07/02/2019
关键点:IF(condition, value_if_true, value_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 (交换工资)的更多相关文章
- 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 ...
- leetcode 627. Swap Salary 数据库带判断的更新操作
https://leetcode.com/problems/swap-salary/description/ 用 set keyWord = Case depentedWord when haha ...
- 627. Swap Salary
627. Swap Salary SQL Schema Given a table salary, such as the one below, that has m=male and f=femal ...
- [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 ...
- SQL语句中IF的简单使用 - 关联leetcode 627.交换工资
MySQL的IF既可以作为表达式用,也可在存储过程中作为流程控制语句使用,如下是做为表达式使用: IF表达式 IF(expr1,expr2,expr3) 如果 expr1 是TRUE (expr1 & ...
- case when then的用法-leetcode交换工资
case具有两种格式:简单case函数和case搜索函数. --简单case函数 case sex when ' then '男' when ' then '女’ else '其他' end --ca ...
- Linux命令 swap:内存交换空间
swap 内存交换空间的概念 swap使用上的限制
- [SQL]LeetCode627. 交换工资 | Swap Salary
SQL架构 create table ), sex ), salary int) Truncate table salary insert into salary (id, name, sex, sa ...
- LeetCode:627.交换工资
题目链接:https://leetcode-cn.com/problems/swap-salary/ 题目 给定一个 salary 表,如下所示,有 m = 男性 和 f = 女性 的值.交换所有的 ...
随机推荐
- Shiro学习(2)身份验证
身份验证,即在应用中谁能证明他就是他本人.一般提供如他们的身份ID一些标识信息来表明他就是他本人,如提供身份证,用户名/密码来证明. 在shiro中,用户需要提供principals (身份)和cre ...
- ROS - 日志
1.日志级别 日志消息分为五个不同的严重级别宏,与Android的Log定义的严重级别类似,如下基础宏: ROS_DEBUG_STREAM.ROS_INFO_STREAM.ROS_WARN_STREA ...
- C++之手写strlen函数
代码: int strlen(const char *str){ assert(str!=NULL); intlen=; while((*str++)!='\0') len++; return len ...
- ArcGIS version not specified.
问题 在调用arcgis10 的ISurface用来取指定航线的地形时,这段代码在加载.dem时总是出错. 报: Fail to open raster dataset 解决方法: 在窗体中加载Map ...
- mysql的数据类型int、bigint、smallint 和 tinyint及id 类型变换
bigint 从 -2^63 (-9223372036854775808) 到 2^63-1 (9223372036854775807) 的整型数据(所有数字).存储大小为 8 个字节. int 从 ...
- SQL Server2012 安装方法详解
SQL Server2012 安装方法详解 - MonkeyBrothers的博客 - CSDN博客 https://blog.csdn.net/monkeybrothers/article/deta ...
- hdu 3486
题意:n个人,每个人的价格a[ i ] ,求最少分几组,每组取一个人,多出来的人就不考虑,使得这取出人的价格大于k.(每组人数一样) 分析:每组取一个人,那这个人肯定是这组最大的,枚举多少组就可以 ...
- webstorm/vs取消eslint
vs ——preference ——setting,添加"eslint.enable": false webstorm ——setting ——language ——javascr ...
- linux 挂载iso文件,挂载ntfs文件系统
映像档不可录就挂载使用.通过loop命令来执行 好吧.跟同事要了一个win10系统盘.插入,竟然是灰色的. ,一点击,提示无法挂载,仔细看了一下下面的内容,原来不支持ntfs格式,好吧,win10系统 ...
- 笔记43 Spring Security简介
基于Spittr应用 一.Spring Security简介 Spring Security是为基于Spring的应用程序提供声明式安全保护的安全 性框架.Spring Security提供了完整的安 ...