[LeetCode][Database]Nth Hightest Salary
来源:互联网 发布:农产品网络推广方案 编辑:程序博客网 时间:2024/06/05 10:27
题目来源:https://leetcode.com/problems/nth-highest-salary/
输出第n高的工资(像之前那道排名的,重复的只算一个排名)
这是做到目前为止第一次套上函数(代入N)。
这道题是看题解抄的,选择不重复的Salary从Employee中。按Salary从大到小排序,然后通过LIMIT M, 1打出结果的第M行第1列
(似乎N-1不能直接使用,只好在外面定义M=N-1)
代码如下:
CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
BEGIN
DECLARE M INT;
SET M=N-1;
RETURN (
# Write your MySQL query statement below.
SELECT DISTINCT Salary
FROM Employee
ORDER BY Salary DESC
LIMIT M, 1
);
END
0 0
- [LeetCode][Database]Nth Hightest Salary
- leetcode-database-177. Nth Highest Salary
- 【leetcode Database】177. Nth Highest Salary
- LeetCode Nth Highest Salary
- 【LeetCode】Second Highest Salary && Nth Highest Salary
- LeetCode | Second Highest Salary & Nth highest salary
- leetcode 177 Nth Highest Salary
- leetcode 177. Nth Highest Salary
- leetcode.177. Nth Highest Salary
- leetcode 177. Nth Highest Salary
- Leetcode 177. Nth Highest Salary
- [LeetCode][Database]Second Highest Salary
- [LeetCode][Database]Department Highest Salary
- 【leetcode】database Second Highest Salary
- Database LeetCode Second Highest Salary
- Database LeetCode Department Highest Salary
- [LeetCode]Nth Highest Salary,解题报告
- leetcode SQL题目 177. Nth Highest Salary
- Hibernate初始化时的Could not parse configuration
- Building 'MyApplication' Gradle project info 的解决办法 android studio V8.0版本
- 数字三角形问题 NOJ 1226
- java设计模式基础-单例模式的几种写法
- 计算机组成第五周:单周期处理器
- [LeetCode][Database]Nth Hightest Salary
- fgbfdcbfbvcbcvbvcbcvbvc
- String和Date之间的转换。。
- Rainy season best wbp brown film faced plywood
- SecureCRT delete删除出错
- 利用mat遍历图像的方法
- 读书笔记
- Java--强引用、软引用、弱引用、虚引用
- 第5周-项目1-深复制纠错