【leetcode】176. 第二高的薪水

题目:
答案:
1
# Write your MySQL query statement below  
select IFNULL((select Distinct Salary from Employee order by Salary DESC limit 1,1),null) as SecondHighestSalary 
2
# Write your MySQL query statement below  
select max(Salary) as SecondHighestSalary from Employee where Salary<(select max(Salary) from Employee) 

笔记:
LIMIT:
select * from Customer LIMIT 10;--检索前10行数据,显示1-10条数据
select * from Customer LIMIT 1,10;--检索从第2行开始,累加10条id记录,共显示id为2....11
select * from Customer limit 5,10;--检索从第6行开始向前加10条数据,共显示id为6,7....15
select * from Customer limit 6,10;--检索从第7行开始向前加10条记录,显示id为7,8...16
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章