赞
踩
Employee
表:
±------------±-----+
| Column Name | Type |
±------------±-----+
| id | int |
| salary | int |
±------------±-----+
在 SQL 中,id 是这个表的主键。
表的每一行包含员工的工资信息。
查询并返回 Employee
表中第二高的薪水 。如果不存在第二高的薪水,查询应该返回 null(Pandas 则返回 None)
。
Create table If Not Exists Employee (id int, salary int)
Truncate table Employee
insert into Employee (id, salary) values ('1', '100')
insert into Employee (id, salary) values ('2', '200')
insert into Employee (id, salary) values ('3', '300')
select distinct (select ifnull((select distinct salary from Employee order by salary desc limit 1,1),null)) as SecondHighestSalary from Employee;
limit 用法:
select 列1,列2,... from _table [where Clause] [limit N][offset M]
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。