mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-02 14:12:17 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>部门表 <code>Department</code>:</p>\n\n<pre>\n+---------------+---------+\n| Column Name | Type |\n+---------------+---------+\n| id | int |\n| revenue | int |\n| month | varchar |\n+---------------+---------+\n(id, month) 是表的联合主键。\n这个表格有关于每个部门每月收入的信息。\n月份(month)可以取下列值 ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]。\n</pre>\n\n<p> </p>\n\n<p>编写一个 SQL 查询来重新格式化表,使得新的表中有一个部门 id 列和一些对应 <strong>每个月 </strong>的收入(revenue)列。</p>\n\n<p>查询结果格式如下面的示例所示:</p>\n\n<pre>\nDepartment 表:\n+------+---------+-------+\n| id | revenue | month |\n+------+---------+-------+\n| 1 | 8000 | Jan |\n| 2 | 9000 | Jan |\n| 3 | 10000 | Feb |\n| 1 | 7000 | Feb |\n| 1 | 6000 | Mar |\n+------+---------+-------+\n\n查询得到的结果表:\n+------+-------------+-------------+-------------+-----+-------------+\n| id | Jan_Revenue | Feb_Revenue | Mar_Revenue | ... | Dec_Revenue |\n+------+-------------+-------------+-------------+-----+-------------+\n| 1 | 8000 | 7000 | 6000 | ... | null |\n| 2 | 9000 | null | null | ... | null |\n| 3 | null | 10000 | null | ... | null |\n+------+-------------+-------------+-------------+-----+-------------+\n\n注意,结果表有 13 列 (1个部门 id 列 + 12个月份的收入列)。\n</pre>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Easy",
|
||||
"likes": 161,
|
||||
"likes": 165,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -47,7 +47,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"36.6K\", \"totalSubmission\": \"57.2K\", \"totalAcceptedRaw\": 36609, \"totalSubmissionRaw\": 57245, \"acRate\": \"64.0%\"}",
|
||||
"stats": "{\"totalAccepted\": \"37.6K\", \"totalSubmission\": \"58.7K\", \"totalAcceptedRaw\": 37571, \"totalSubmissionRaw\": 58655, \"acRate\": \"64.1%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
Reference in New Issue
Block a user