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/calculate-special-bonus.json
2022-05-02 23:44:12 +08:00

80 lines
7.9 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": "2024",
"questionFrontendId": "1873",
"categoryTitle": "Database",
"boundTopicId": 794609,
"title": "Calculate Special Bonus",
"titleSlug": "calculate-special-bonus",
"content": "<p>Table: <code>Employees</code></p>\n\n<pre>\n+-------------+---------+\n| Column Name | Type |\n+-------------+---------+\n| employee_id | int |\n| name | varchar |\n| salary | int |\n+-------------+---------+\nemployee_id is the primary key for this table.\nEach row of this table indicates the employee ID, employee name, and salary.\n</pre>\n\n<p>&nbsp;</p>\n\n<p>Write an SQL query to calculate the bonus of each employee. The bonus of an employee is <code>100%</code> of their salary if the ID of the employee is <strong>an odd number</strong> and <strong>the employee name does not start with the character </strong><code>&#39;M&#39;</code>. The bonus of an employee is <code>0</code> otherwise.</p>\n\n<p>Return the result table ordered by <code>employee_id</code>.</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> \nEmployees table:\n+-------------+---------+--------+\n| employee_id | name | salary |\n+-------------+---------+--------+\n| 2 | Meir | 3000 |\n| 3 | Michael | 3800 |\n| 7 | Addilyn | 7400 |\n| 8 | Juan | 6100 |\n| 9 | Kannon | 7700 |\n+-------------+---------+--------+\n<strong>Output:</strong> \n+-------------+-------+\n| employee_id | bonus |\n+-------------+-------+\n| 2 | 0 |\n| 3 | 0 |\n| 7 | 7400 |\n| 8 | 0 |\n| 9 | 7700 |\n+-------------+-------+\n<strong>Explanation:</strong> \nThe employees with IDs 2 and 8 get 0 bonus because they have an even employee_id.\nThe employee with ID 3 gets 0 bonus because their name starts with &#39;M&#39;.\nThe rest of the employees get a 100% bonus.\n</pre>\n",
"translatedTitle": "计算特殊奖金",
"translatedContent": "<p>表: <code>Employees</code></p>\n\n<pre>\n+-------------+---------+\n| 列名 | 类型 |\n+-------------+---------+\n| employee_id | int |\n| name | varchar |\n| salary | int |\n+-------------+---------+\nemployee_id 是这个表的主键。\n此表的每一行给出了雇员id ,名字和薪水。\n</pre>\n\n<p>&nbsp;</p>\n\n<p>写出一个SQL 查询语句计算每个雇员的奖金。如果一个雇员的id是奇数并且他的名字不是以'M'开头那么他的奖金是他工资的100%否则奖金为0。</p>\n\n<p>Return the result table ordered by <code>employee_id</code>.</p>\n\n<p>返回的结果集请按照<code>employee_id</code>排序。</p>\n\n<p>查询结果格式如下面的例子所示。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>\nEmployees 表:\n+-------------+---------+--------+\n| employee_id | name | salary |\n+-------------+---------+--------+\n| 2 | Meir | 3000 |\n| 3 | Michael | 3800 |\n| 7 | Addilyn | 7400 |\n| 8 | Juan | 6100 |\n| 9 | Kannon | 7700 |\n+-------------+---------+--------+\n<strong>输出:</strong>\n+-------------+-------+\n| employee_id | bonus |\n+-------------+-------+\n| 2 | 0 |\n| 3 | 0 |\n| 7 | 7400 |\n| 8 | 0 |\n| 9 | 7700 |\n+-------------+-------+\n<strong>解释:</strong>\n因为雇员id是偶数所以雇员id 是2和8的两个雇员得到的奖金是0。\n雇员id为3的因为他的名字以'M'开头所以奖金是0。\n其他的雇员得到了百分之百的奖金。</pre>\n",
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 25,
"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"
}
],
"stats": "{\"totalAccepted\": \"10.8K\", \"totalSubmission\": \"13.6K\", \"totalAcceptedRaw\": 10841, \"totalSubmissionRaw\": 13596, \"acRate\": \"79.7%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "{\"headers\":{\"Employees\":[\"employee_id\",\"name\",\"salary\"]},\"rows\":{\"Employees\":[[2,\"Meir\",3000],[3,\"Michael\",3800],[7,\"Addilyn\",7400],[8,\"Juan\",6100],[9,\"Kannon\",7700]]}}",
"metaData": "{\n \"mysql\": [\n \"Create table If Not Exists Employees (employee_id int, name varchar(30), salary int)\"\n ],\n \"mssql\": [\n \"Create table Employees (employee_id int, name varchar(30), salary int)\"\n ],\n \"oraclesql\": [\n \"Create table Employees (employee_id int, name varchar(30), salary int)\"\n ],\n \"database\": true\n}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
"Create table If Not Exists Employees (employee_id int, name varchar(30), salary int)",
"Truncate table Employees",
"insert into Employees (employee_id, name, salary) values ('2', 'Meir', '3000')",
"insert into Employees (employee_id, name, salary) values ('3', 'Michael', '3800')",
"insert into Employees (employee_id, name, salary) values ('7', 'Addilyn', '7400')",
"insert into Employees (employee_id, name, salary) values ('8', 'Juan', '6100')",
"insert into Employees (employee_id, name, salary) values ('9', 'Kannon', '7700')"
],
"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\":{\"Employees\":[\"employee_id\",\"name\",\"salary\"]},\"rows\":{\"Employees\":[[2,\"Meir\",3000],[3,\"Michael\",3800],[7,\"Addilyn\",7400],[8,\"Juan\",6100],[9,\"Kannon\",7700]]}}",
"__typename": "QuestionNode"
}
}
}