Liupeng
Jun 11, 2020
第二高的薪水
Title
MyCode
select (
select salary from employee
group by salary
order by salary desc
limit 1 offset 1
) as SecondHighestSalary;
Result
Learning
-
group by
分组关键词:对某一个字段进行分组,例如:相同姓名的分一组
-
order by xxx
排序: 针对某一字段进行排序,例如:针对成绩进行排序,默认从小到大
-
order by xxx desc
排序: 针对某一字段进行排序,例如:针对成绩进行排序,从大到小
-
limit numberI numberII
第numberI + 1到numberI + numberII + 1个
-
as
为查询的字段起一个别名