177.Nth_Highest_Salary
来源:互联网 发布:网络信用卡怎么申请 编辑:程序博客网 时间:2024/05/22 01:39
Write a SQL query to get the nth highest salary from the Employee table.
#+----+--------+#| Id | Salary |#+----+--------+#| 1 | 100 |#| 2 | 200 |#| 3 | 300 |#+----+--------+
For example, given the above Employee table, , the nth highest salary where n = 2 is 200. If there is no nth highest salary, then the query should return null.
+------------------------+| getNthHighestSalary(2) |+------------------------+| 200 |+------------------------+
sql脚本
CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INTBEGIN SET N = N-1; RETURN ( SELECT DISTINCT Salary FROM Employee ORDER BY Salary DESC LIMIT 1 OFFSET N );END
阅读全文
0 0
- 177.Nth_Highest_Salary
- 177. Nth Highest Salary
- 177.n1-组图
- leetcode 177. Nth Highest Salary
- leetcode.177. Nth Highest Salary
- leetcode 177. Nth Highest Salary
- Leetcode 177. Nth Highest Salary
- 177.n1-banner的监听
- leetcode-database-177. Nth Highest Salary
- leetcode SQL题目 177. Nth Highest Salary
- 【leetcode Database】177. Nth Highest Salary
- 177. [USACO Jan07] 有限制的素数
- SQL锁机制高级篇http://tamsun.spaces.live.com/blog/cns!549A39619D3FADA3!177.entry
- 177.Give a dog a bad name and hang him. 众口铄金,积毁销骨
- 177.Which three statements are correct about temporary tables? (Choose three.)
- LintCode | 177. 把排序数组转换为高度最小的二叉搜索树
- 177.把排序数组转换为高度最小的二叉搜索树
- 177. 把排序数组转换为高度最小的二叉搜索树
- sql 中的concat()函数及JAVA时间类在Hibernate中的映射
- iOS正则表达式判断手机号和密码
- sort-list
- xuenhao(banner xlisview)
- [Leetcode 621] Task Scheduler
- 177.Nth_Highest_Salary
- ActiveMQ讯息传送机制以及ACK机制
- 官方教程survivalshooter 关于animator的灵异性bug
- 生成柱面层和踢脚面
- Adobe AE CC切换语言 中英文切换
- 动态内存分配
- 阿里云oss接口listObjects获取文件列表出现空目录
- 数组中重复的数字
- 【Cocos2d-x】开发基础-第一个Cocos2d-x游戏