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/originData/employee-bonus.json
2023-12-09 19:57:46 +08:00

98 lines
10 KiB
JSON
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.

{
"data": {
"question": {
"questionId": "577",
"questionFrontendId": "577",
"categoryTitle": "Database",
"boundTopicId": 1998,
"title": "Employee Bonus",
"titleSlug": "employee-bonus",
"content": "<p>Table: <code>Employee</code></p>\n\n<pre>\n+-------------+---------+\n| Column Name | Type |\n+-------------+---------+\n| empId | int |\n| name | varchar |\n| supervisor | int |\n| salary | int |\n+-------------+---------+\nempId is the column with unique values for this table.\nEach row of this table indicates the name and the ID of an employee in addition to their salary and the id of their manager.\n</pre>\n\n<p>&nbsp;</p>\n\n<p>Table: <code>Bonus</code></p>\n\n<pre>\n+-------------+------+\n| Column Name | Type |\n+-------------+------+\n| empId | int |\n| bonus | int |\n+-------------+------+\nempId is the column of unique values for this table.\nempId is a foreign key (reference column) to empId from the Employee table.\nEach row of this table contains the id of an employee and their respective bonus.\n</pre>\n\n<p>&nbsp;</p>\n\n<p>Write a solution to report the name and bonus amount of each employee with a bonus <strong>less than</strong> <code>1000</code>.</p>\n\n<p>Return the result table in <strong>any order</strong>.</p>\n\n<p>The&nbsp;result format is in the following example.</p>\n\n<p>&nbsp;</p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> \nEmployee table:\n+-------+--------+------------+--------+\n| empId | name | supervisor | salary |\n+-------+--------+------------+--------+\n| 3 | Brad | null | 4000 |\n| 1 | John | 3 | 1000 |\n| 2 | Dan | 3 | 2000 |\n| 4 | Thomas | 3 | 4000 |\n+-------+--------+------------+--------+\nBonus table:\n+-------+-------+\n| empId | bonus |\n+-------+-------+\n| 2 | 500 |\n| 4 | 2000 |\n+-------+-------+\n<strong>Output:</strong> \n+------+-------+\n| name | bonus |\n+------+-------+\n| Brad | null |\n| John | null |\n| Dan | 500 |\n+------+-------+\n</pre>\n",
"translatedTitle": "员工奖金",
"translatedContent": "<p>表:<code>Employee</code>&nbsp;</p>\n\n<pre>\n+-------------+---------+\n| Column Name | Type |\n+-------------+---------+\n| empId | int |\n| name | varchar |\n| supervisor | int |\n| salary | int |\n+-------------+---------+\nempId 是该表中具有唯一值的列。\n该表的每一行都表示员工的姓名和 id以及他们的工资和经理的 id。\n</pre>\n\n<p>&nbsp;</p>\n\n<p>表:<code>Bonus</code></p>\n\n<pre>\n+-------------+------+\n| Column Name | Type |\n+-------------+------+\n| empId | int |\n| bonus | int |\n+-------------+------+\nempId 是该表具有唯一值的列。\nempId 是 Employee 表中 empId 的外键(reference 列)。\n该表的每一行都包含一个员工的 id 和他们各自的奖金。\n</pre>\n\n<p>&nbsp;</p>\n\n<p>编写解决方案,报告每个奖金 <strong>少于</strong> <code>1000</code> 的员工的姓名和奖金数额。</p>\n\n<p>以 <strong>任意顺序</strong> 返回结果表。</p>\n\n<p>结果格式如下所示。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<b>输入:</b>\nEmployee table:\n+-------+--------+------------+--------+\n| empId | name | supervisor | salary |\n+-------+--------+------------+--------+\n| 3 | Brad | null | 4000 |\n| 1 | John | 3 | 1000 |\n| 2 | Dan | 3 | 2000 |\n| 4 | Thomas | 3 | 4000 |\n+-------+--------+------------+--------+\nBonus table:\n+-------+-------+\n| empId | bonus |\n+-------+-------+\n| 2 | 500 |\n| 4 | 2000 |\n+-------+-------+\n<b>输出:</b>\n+------+-------+\n| name | bonus |\n+------+-------+\n| Brad | null |\n| John | null |\n| Dan | 500 |\n+------+-------+</pre>\n",
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 81,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[{\"title\": \"Combine Two Tables\", \"titleSlug\": \"combine-two-tables\", \"difficulty\": \"Easy\", \"translatedTitle\": \"\\u7ec4\\u5408\\u4e24\\u4e2a\\u8868\", \"isPaidOnly\": false}]",
"contributors": [],
"langToValidPlayground": "{\"cpp\": false, \"java\": false, \"python\": false, \"python3\": false, \"mysql\": false, \"mssql\": false, \"oraclesql\": false, \"c\": false, \"csharp\": false, \"javascript\": false, \"typescript\": false, \"bash\": false, \"php\": false, \"swift\": false, \"kotlin\": false, \"dart\": false, \"golang\": false, \"ruby\": false, \"scala\": false, \"html\": false, \"pythonml\": false, \"rust\": false, \"racket\": false, \"erlang\": false, \"elixir\": false, \"pythondata\": false, \"react\": false, \"vanillajs\": false, \"postgresql\": 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"
},
{
"lang": "Pandas",
"langSlug": "pythondata",
"code": "import pandas as pd\n\ndef employee_bonus(employee: pd.DataFrame, bonus: pd.DataFrame) -> pd.DataFrame:\n ",
"__typename": "CodeSnippetNode"
},
{
"lang": "PostgreSQL",
"langSlug": "postgresql",
"code": "-- Write your PostgreSQL query statement below",
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"60.6K\", \"totalSubmission\": \"87.3K\", \"totalAcceptedRaw\": 60601, \"totalSubmissionRaw\": 87326, \"acRate\": \"69.4%\"}",
"hints": [
"If the EmpId in table Employee has no match in table Bonus, we consider that the corresponding bonus is null and null is smaller than 1000.",
"Inner join is the default join, we can solve the mismatching problem by using outer join."
],
"solution": null,
"status": null,
"sampleTestCase": "{\"headers\":{\"Employee\":[\"empId\",\"name\",\"supervisor\",\"salary\"],\"Bonus\":[\"empId\",\"bonus\"]},\"rows\":{\"Employee\":[[3,\"Brad\",null,4000],[1,\"John\",3,1000],[2,\"Dan\",3,2000],[4,\"Thomas\",3,4000]],\"Bonus\":[[2,500],[4,2000]]}}",
"metaData": "{\"mysql\":[\"Create table If Not Exists Employee (empId int, name varchar(255), supervisor int, salary int)\",\"Create table If Not Exists Bonus (empId int, bonus int)\"],\"mssql\":[\"Create table Employee (empId int, name varchar(255), supervisor int, salary int)\",\"Create table Bonus (empId int, bonus int)\"],\"oraclesql\":[\"Create table Employee (empId int, name varchar(255), supervisor int, salary int)\",\"Create table Bonus (empId int, bonus int)\"],\"database\":true,\"name\":\"employee_bonus\",\"manual\":false,\"pythondata\":[\"Employee = pd.DataFrame([], columns=['empId', 'name', 'supervisor', 'salary']).astype({'empId':'Int64', 'name':'object', 'supervisor':'Int64', 'salary':'Int64'})\",\"Bonus = pd.DataFrame([], columns=['empId', 'bonus']).astype({'empId':'Int64', 'bonus':'Int64'})\"],\"postgresql\":[\"Create table If Not Exists Employee (empId int, name varchar(255), supervisor int, salary int)\\n\",\"Create table If Not Exists Bonus (empId int, bonus int)\"],\"database_schema\":{\"Employee\":{\"empId\":\"INT\",\"name\":\"VARCHAR(255)\",\"supervisor\":\"INT\",\"salary\":\"INT\"},\"Bonus\":{\"empId\":\"INT\",\"bonus\":\"INT\"}}}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
"Create table If Not Exists Employee (empId int, name varchar(255), supervisor int, salary int)",
"Create table If Not Exists Bonus (empId int, bonus int)",
"Truncate table Employee",
"insert into Employee (empId, name, supervisor, salary) values ('3', 'Brad', 'None', '4000')",
"insert into Employee (empId, name, supervisor, salary) values ('1', 'John', '3', '1000')",
"insert into Employee (empId, name, supervisor, salary) values ('2', 'Dan', '3', '2000')",
"insert into Employee (empId, name, supervisor, salary) values ('4', 'Thomas', '3', '4000')",
"Truncate table Bonus",
"insert into Bonus (empId, bonus) values ('2', '500')",
"insert into Bonus (empId, bonus) values ('4', '2000')"
],
"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>\"],\"pythondata\":[\"Pandas\",\"<p>Python 3.10 with Pandas 2.0.2 and NumPy 1.25.0<\\/p>\"],\"postgresql\":[\"PostgreSQL\",\"<p>PostgreSQL 16<\\/p>\"]}",
"book": null,
"isSubscribed": false,
"isDailyQuestion": false,
"dailyRecordStatus": null,
"editorType": "CKEDITOR",
"ugcQuestionId": null,
"style": "LEETCODE",
"exampleTestcases": "{\"headers\":{\"Employee\":[\"empId\",\"name\",\"supervisor\",\"salary\"],\"Bonus\":[\"empId\",\"bonus\"]},\"rows\":{\"Employee\":[[3,\"Brad\",null,4000],[1,\"John\",3,1000],[2,\"Dan\",3,2000],[4,\"Thomas\",3,4000]],\"Bonus\":[[2,500],[4,2000]]}}",
"__typename": "QuestionNode"
}
}
}