1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/第N高的薪水 [nth-highest-salary].html

60 lines
1.2 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>表:&nbsp;<code>Employee</code></p>
<pre>
+-------------+------+
| Column Name | Type |
+-------------+------+
| id | int |
| salary | int |
+-------------+------+
在 SQL 中id 是该表的主键。
该表的每一行都包含有关员工工资的信息。
</pre>
<p>&nbsp;</p>
<p>查询&nbsp;<code>Employee</code> 表中第 <code>n</code> 高的工资。如果没有第 <code>n</code> 个最高工资,查询结果应该为&nbsp;<code>null</code></p>
<p>查询结果格式如下所示。</p>
<p>&nbsp;</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>