"content":"<p>Table: <code>Employee</code></p>\n\n<pre>\n+--------------+---------+\n| Column Name | Type |\n+--------------+---------+\n| id | int |\n| name | varchar |\n| salary | int |\n| departmentId | int |\n+--------------+---------+\nid is the primary key column for this table.\ndepartmentId is a foreign key of the ID from the <code>Department </code>table.\nEach row of this table indicates the ID, name, and salary of an employee. It also contains the ID of their department.\n</pre>\n\n<p> </p>\n\n<p>Table: <code>Department</code></p>\n\n<pre>\n+-------------+---------+\n| Column Name | Type |\n+-------------+---------+\n| id | int |\n| name | varchar |\n+-------------+---------+\nid is the primary key column for this table.\nEach row of this table indicates the ID of a department and its name.\n</pre>\n\n<p> </p>\n\n<p>A company's executives are interested in seeing who earns the most money in each of the company's departments. A <strong>high earner</strong> in a department is an employee who has a salary in the <strong>top three unique</strong> salaries for that department.</p>\n\n<p>Write an SQL query to find the employees who are <strong>high earners</strong> in each of the departments.</p>\n\n<p>Return the result table <strong>in any order</strong>.</p>\n\n<p>The query result format is in the following example.</p>\n\n<p> </p>\n<p><strong>Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> \nEmployee table:\n+----+-------+--------+--------------+\n| id | name | salary | departmentId |\n+----+-------+--------+--------------+\n| 1 | Joe | 85000 | 1 |\n| 2 | Henry | 80000 | 2 |\n| 3 | Sam | 60000 | 2 |\n| 4 | Max | 90000 | 1 |\n| 5 | Janet | 69000 | 1 |\n| 6 | Randy | 85000 | 1 |\n| 7 | Will | 70000 | 1 |\n+----+-------+--------+--------------+\nDepartment table:\n+----+-------+\n| id | name |\n+----+-------+\n| 1 | IT |\n| 2 | Sales |\n+----+-------+\n<strong>Output:</strong> \n+------------+----------+--------+\n| Department | Employee | Salary |\n+------------+----------+--------+\n| IT | Max | 90000 |\n| IT | Joe | 85000 |\n| IT | Randy | 85000 |\n| IT | Will | 70000 |\n| Sales | Henry | 80000 |\n| Sales | Sam | 60000 |\n+------------+----------+--------+\n<strong>Explanation:</strong> \nIn the IT department:\n- Max earns the highest unique salary\n- Both Randy and Joe earn the second-highest unique salary\n- Will earns the third-highest unique salary\n\nIn the Sales department:\n- Henry earns the highest salary\n- Sam earns the second-highest salary\n- There is no third-highest salary as there are only two employees\n</pre>\n",
"translatedTitle":"部门工资前三高的所有员工",
"translatedContent":"<p>表: <code>Employee</code></p>\n\n<pre>\n+--------------+---------+\n| Column Name | Type |\n+--------------+---------+\n| id | int |\n| name | varchar |\n| salary | int |\n| departmentId | int |\n+--------------+---------+\nId是该表的主键列。\ndepartmentId是Department表中ID的外键。\n该表的每一行都表示员工的ID、姓名和工资。它还包含了他们部门的ID。\n</pre>\n\n<p> </p>\n\n<p>表: <code>Department</code></p>\n\n<pre>\n+-------------+---------+\n| Column Name | Type |\n+-------------+---------+\n| id | int |\n| name | varchar |\n+-------------+---------+\nId是该表的主键列。\n该表的每一行表示部门ID和部门名。\n</pre>\n\n<p> </p>\n\n<p>公司的主管们感兴趣的是公司每个部门中谁赚的钱最多。一个部门的 <strong>高收入者</strong> 是指一个员工的工资在该部门的 <strong>不同</strong> 工资中 <strong>排名前三</strong> 。</p>\n\n<p>编写一个SQL查询,找出每个部门中 <strong>收入高的员工</strong> 。</p>\n\n<p>以 <strong>任意顺序</strong> 返回结果表。</p>\n\n<p>查询结果格式如下所示。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong> \nEmployee 表:\n+----+-------+--------+--------------+\n| id | name | salary | departmentId |\n+----+-------+--------+--------------+\n| 1 | Joe | 85000 | 1 |\n| 2 | Henry | 80000 | 2 |\n| 3 | Sam | 60000 | 2 |\n| 4 | Max | 90000 | 1 |\n| 5 | Janet | 69000 | 1 |\n| 6 | Randy | 85000 | 1 |\n| 7 | Will | 70000 | 1 |\n+----+-------+--------+--------------+\nDepartment 表:\n+----+-------+\n| id | name |\n+----+-------+\n| 1 | IT |\n| 2 | Sales |\n+----+-------+\n<strong>输出:</strong> \n+------------+----------+--------+\n| Department | Employee | Salary |\n+------------+----------+--------+\n| IT | Max | 90000 |\n| IT | Joe | 85000 |\n| IT | Randy | 85000 |\n| IT | Will | 70000 |\n| Sales | Henry | 80000 |\n| Sales | Sam | 60000 |\n+------------+----------+--------+\n<strong>解释:\n</strong>在IT部门:\n- Max的工资最高\n- 兰迪和乔都赚取第二高的独特的薪水\n- 威尔的薪水是第三高的\n\n在销售部:\n- 亨利的工资最高\n- 山姆的薪水第二高\n- 没有第三高的工资,因为只有两名员工</pre>\n",
"metaData":"{\n \"mysql\": [\n \"Create table If Not Exists Employee (id int, name varchar(255), salary int, departmentId int)\",\n \"Create table If Not Exists Department (id int, name varchar(255))\"\n ],\n \"mssql\": [\n \"Create table Employee (id int, name varchar(255), salary int, departmentId int)\",\n \"Create table Department (id int, name varchar(255))\"\n ],\n \"oraclesql\": [\n \"Create table Employee (id int, name varchar(255), salary int, departmentId int)\",\n \"Create table Department (id int, name varchar(255))\"\n ],\n \"database\": true\n}",
"judgerAvailable":true,
"judgeType":"large",
"mysqlSchemas":[
"Create table If Not Exists Employee (id int, name varchar(255), salary int, departmentId int)",
"Create table If Not Exists Department (id int, name varchar(255))",