1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/originData/department-highest-salary.json

84 lines
9.3 KiB
JSON
Raw Normal View History

2022-03-27 20:56:26 +08:00
{
"data": {
"question": {
"questionId": "184",
"questionFrontendId": "184",
"categoryTitle": "Database",
"boundTopicId": 1338,
"title": "Department Highest Salary",
"titleSlug": "department-highest-salary",
"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>&nbsp;</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>&nbsp;</p>\n\n<p>Write an SQL query to find employees who have the highest salary in each of the departments.</p>\n\n<p>Return the result table in <strong>any order</strong>.</p>\n\n<p>The query result format is in the following example.</p>\n\n<p>&nbsp;</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 | 70000 | 1 |\n| 2 | Jim | 90000 | 1 |\n| 3 | Henry | 80000 | 2 |\n| 4 | Sam | 60000 | 2 |\n| 5 | Max | 90000 | 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 | Jim | 90000 |\n| Sales | Henry | 80000 |\n| IT | Max | 90000 |\n+------------+----------+--------+\n<strong>Explanation:</strong> Max and Jim both have the highest salary in the IT department and Henry has the highest salary in the Sales department.\n</pre>\n",
"translatedTitle": "部门工资最高的员工",
"translatedContent": "<p>表:&nbsp;<code>Employee</code></p>\n\n<pre>\n+--------------+---------+\n| 列名 | 类型 |\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>&nbsp;</p>\n\n<p>表:&nbsp;<code>Department</code></p>\n\n<pre>\n+-------------+---------+\n| 列名 | 类型 |\n+-------------+---------+\n| id | int |\n| name | varchar |\n+-------------+---------+\nid是此表的主键列。\n此表的每一行都表示一个部门的ID及其名称。\n</pre>\n\n<p>&nbsp;</p>\n\n<p>编写SQL查询以查找每个部门中薪资最高的员工。<br />\n按 <strong>任意顺序</strong> 返回结果表。<br />\n查询结果格式如下例所示。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<b>输入:</b>\nEmployee 表:\n+----+-------+--------+--------------+\n| id | name | salary | departmentId |\n+----+-------+--------+--------------+\n| 1 | Joe | 70000 | 1 |\n| 2 | Jim | 90000 | 1 |\n| 3 | Henry | 80000 | 2 |\n| 4 | Sam | 60000 | 2 |\n| 5 | Max | 90000 | 1 |\n+----+-------+--------+--------------+\nDepartment 表:\n+----+-------+\n| id | name |\n+----+-------+\n| 1 | IT |\n| 2 | Sales |\n+----+-------+\n<b>输出:</b>\n+------------+----------+--------+\n| Department | Employee | Salary |\n+------------+----------+--------+\n| IT | Jim | 90000 |\n| Sales | Henry | 80000 |\n| IT | Max | 90000 |\n+------------+----------+--------+\n<strong>解释:</strong>Max 和 Jim 在 IT 部门的工资都是最高的Henry 在销售部的工资最高。</pre>\n",
"isPaidOnly": false,
"difficulty": "Medium",
2022-05-02 23:44:12 +08:00
"likes": 499,
2022-03-27 20:56:26 +08:00
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
"contributors": [],
"langToValidPlayground": "{\"cpp\": false, \"java\": false, \"python\": false, \"python3\": false, \"mysql\": false, \"mssql\": false, \"oraclesql\": false, \"c\": false, \"csharp\": false, \"javascript\": false, \"ruby\": false, \"bash\": false, \"swift\": false, \"golang\": false, \"scala\": false, \"html\": false, \"pythonml\": false, \"kotlin\": false, \"rust\": false, \"php\": false, \"typescript\": false, \"racket\": false, \"erlang\": false, \"elixir\": false}",
"topicTags": [
{
"name": "Database",
"slug": "database",
"translatedName": "数据库",
"__typename": "TopicTagNode"
}
],
"companyTagStats": null,
"codeSnippets": [
{
"lang": "MySQL",
"langSlug": "mysql",
"code": "# Write your MySQL query statement below",
"__typename": "CodeSnippetNode"
},
{
"lang": "MS SQL Server",
"langSlug": "mssql",
"code": "/* Write your T-SQL query statement below */",
"__typename": "CodeSnippetNode"
},
{
"lang": "Oracle",
"langSlug": "oraclesql",
"code": "/* Write your PL/SQL query statement below */",
"__typename": "CodeSnippetNode"
}
],
2022-05-02 23:44:12 +08:00
"stats": "{\"totalAccepted\": \"127.3K\", \"totalSubmission\": \"258.8K\", \"totalAcceptedRaw\": 127304, \"totalSubmissionRaw\": 258806, \"acRate\": \"49.2%\"}",
2022-03-27 20:56:26 +08:00
"hints": [],
"solution": null,
"status": null,
2022-05-02 23:44:12 +08:00
"sampleTestCase": "{\"headers\": {\"Employee\": [\"Id\", \"Name\", \"Salary\", \"DepartmentId\"], \"Department\": [\"Id\", \"Name\"]}, \"rows\": {\"Employee\": [[1, \"Joe\", 70000, 1], [2, \"Jim\", 90000, 1], [3, \"Henry\", 80000, 2], [4, \"Sam\", 60000, 2], [5, \"Max\", 90000, 1]], \"Department\": [[1, \"IT\"], [2, \"Sales\"]]}}",
2022-03-27 20:56:26 +08:00
"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))",
"Truncate table Employee",
"insert into Employee (id, name, salary, departmentId) values ('1', 'Joe', '70000', '1')",
"insert into Employee (id, name, salary, departmentId) values ('2', 'Jim', '90000', '1')",
"insert into Employee (id, name, salary, departmentId) values ('3', 'Henry', '80000', '2')",
"insert into Employee (id, name, salary, departmentId) values ('4', 'Sam', '60000', '2')",
"insert into Employee (id, name, salary, departmentId) values ('5', 'Max', '90000', '1')",
"Truncate table Department",
"insert into Department (id, name) values ('1', 'IT')",
"insert into Department (id, name) values ('2', 'Sales')"
],
"enableRunCode": true,
"envInfo": "{\"mysql\":[\"MySQL\",\"<p>\\u7248\\u672c\\uff1a<code>MySQL 8.0<\\/code><\\/p>\"],\"mssql\":[\"MS SQL Server\",\"<p>mssql server 2019.<\\/p>\"],\"oraclesql\":[\"Oracle\",\"<p>Oracle Sql 11.2.<\\/p>\"]}",
"book": null,
"isSubscribed": false,
"isDailyQuestion": false,
"dailyRecordStatus": null,
"editorType": "CKEDITOR",
"ugcQuestionId": null,
"style": "LEETCODE",
"exampleTestcases": "{\"headers\": {\"Employee\": [\"id\", \"name\", \"salary\", \"departmentId\"], \"Department\": [\"id\", \"name\"]}, \"rows\": {\"Employee\": [[1, \"Joe\", 70000, 1], [2, \"Jim\", 90000, 1], [3, \"Henry\", 80000, 2], [4, \"Sam\", 60000, 2], [5, \"Max\", 90000, 1]], \"Department\": [[1, \"IT\"], [2, \"Sales\"]]}}",
"__typename": "QuestionNode"
}
}
}