mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-14 03:41:41 +08:00
add leetcode problem-cn part6
This commit is contained in:
59
算法题(国内版)/problem (Chinese)/第N高的薪水 [nth-highest-salary].html
Normal file
59
算法题(国内版)/problem (Chinese)/第N高的薪水 [nth-highest-salary].html
Normal file
@@ -0,0 +1,59 @@
|
||||
<p>表: <code>Employee</code></p>
|
||||
|
||||
<pre>
|
||||
+-------------+------+
|
||||
| Column Name | Type |
|
||||
+-------------+------+
|
||||
| id | int |
|
||||
| salary | int |
|
||||
+-------------+------+
|
||||
Id是该表的主键列。
|
||||
该表的每一行都包含有关员工工资的信息。
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p>编写一个SQL查询来报告 <code>Employee</code> 表中第 <code>n</code> 高的工资。如果没有第 <code>n</code> 个最高工资,查询应该报告为 <code>null</code> 。</p>
|
||||
|
||||
<p>查询结果格式如下所示。</p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>示例 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>
|
||||
Employee table:
|
||||
+----+--------+
|
||||
| id | salary |
|
||||
+----+--------+
|
||||
| 1 | 100 |
|
||||
| 2 | 200 |
|
||||
| 3 | 300 |
|
||||
+----+--------+
|
||||
n = 2
|
||||
<strong>输出:</strong>
|
||||
+------------------------+
|
||||
| getNthHighestSalary(2) |
|
||||
+------------------------+
|
||||
| 200 |
|
||||
+------------------------+
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>
|
||||
Employee 表:
|
||||
+----+--------+
|
||||
| id | salary |
|
||||
+----+--------+
|
||||
| 1 | 100 |
|
||||
+----+--------+
|
||||
n = 2
|
||||
<strong>输出:</strong>
|
||||
+------------------------+
|
||||
| getNthHighestSalary(2) |
|
||||
+------------------------+
|
||||
| null |
|
||||
+------------------------+</pre>
|
Reference in New Issue
Block a user