Leetcode177. Nth Highest Salary
来源:互联网 发布:印第安 中国 知乎 编辑:程序博客网 时间:2024/05/29 03:53
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 |
+————————+
和上一题没什么差别,输出第2个和第n个是一样的。
CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INTBEGINDECLARE M INT;SET M=N-1; RETURN ( # Write your MySQL query statement below. SELECT IFNULL( (SELECT DISTINCT Salary FROM Employee ORDER BY Salary DESC LIMIT M,1) , NULL) );END
阅读全文
0 0
- Leetcode177. Nth Highest Salary
- leetcode177-Nth Highest Salary(找出第n大的数据)
- Leetcode177. Nth Highest Salary(SQL语句中使用函数)
- LeetCode Nth Highest Salary
- Nth Highest Salary
- Nth Highest Salary
- 177 - Nth Highest Salary
- Nth Highest Salary
- Nth Highest Salary
- MySQL-Nth Highest Salary
- 177. Nth Highest Salary
- 【LeetCode】Second Highest Salary && Nth Highest Salary
- LeetCode | Second Highest Salary & Nth highest salary
- leetcode 177 Nth Highest Salary
- LeetCode_OJ【177】Nth Highest Salary
- leetcode 177. Nth Highest Salary
- leetcode.177. Nth Highest Salary
- leetcode 177. Nth Highest Salary
- Linux修改硬件时间与系统时间差
- 文章标题
- python进阶--内置函数
- 单片机系统时钟与实时时钟有什么区别?为什么有的系统时钟晶振使用12M,而实时时钟使用32.768K
- java后台简单异步处理例子
- Leetcode177. Nth Highest Salary
- 找出一个列表中出现次数最多的元素
- C语言 通讯录
- 二叉树的遍历
- Educational Codeforces Round 24 (B Permutation Game,D. Multicolored Cars)
- Kotlin语法基础,控制流
- js小知识
- windows下文件后缀名批量删除和修改
- 首页学习--返回顶部js及html