当前位置: 移动技术网 > IT编程>数据库>Mysql > mysql函数练习题之第二高的薪水+交换工资的题解

mysql函数练习题之第二高的薪水+交换工资的题解

2018年12月28日  | 移动技术网IT编程  | 我要评论

题176. 第二高的薪水:max( )函数

\

思路:先查找最高收入的薪水,在小于最高收入里面查找最高收入,即第二高收入。

select max(salary) as secondhighestsalary from employee 
where salary <
(select max(salary) from employee);

题627. 交换工资:if( )函数

\

思路:if( ) 方法

update salary
set sex=if(sex='m','f','m');

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网