mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-21 21:16:45 +08:00
update
This commit is contained in:
@@ -12,12 +12,12 @@
|
||||
"translatedContent": "<p>表:<code>Products</code></p>\n\n<pre>\n+-------------+---------+\n| Column Name | Type |\n+-------------+---------+\n| product_id | int |\n| store1 | int |\n| store2 | int |\n| store3 | int |\n+-------------+---------+\n在 SQL 中,这张表的主键是 product_id(产品Id)。\n每行存储了这一产品在不同商店 store1, store2, store3 的价格。\n如果这一产品在商店里没有出售,则值将为 null。\n</pre>\n\n<p> </p>\n\n<p>请你重构 <code>Products</code> 表,查询每个产品在不同商店的价格,使得输出的格式变为<code>(product_id, store, price)</code> 。如果这一产品在商店里没有出售,则不输出这一行。</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>\nProducts table:\n+------------+--------+--------+--------+\n| product_id | store1 | store2 | store3 |\n+------------+--------+--------+--------+\n| 0 | 95 | 100 | 105 |\n| 1 | 70 | null | 80 |\n+------------+--------+--------+--------+\n<strong>输出:</strong>\n+------------+--------+-------+\n| product_id | store | price |\n+------------+--------+-------+\n| 0 | store1 | 95 |\n| 0 | store2 | 100 |\n| 0 | store3 | 105 |\n| 1 | store1 | 70 |\n| 1 | store3 | 80 |\n+------------+--------+-------+\n<strong>解释:</strong>\n产品 0 在 store1、store2、store3 的价格分别为 95、100、105。\n产品 1 在 store1、store3 的价格分别为 70、80。在 store2 无法买到。</pre>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Easy",
|
||||
"likes": 183,
|
||||
"likes": 191,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[{\"title\": \"Product's Price for Each Store\", \"titleSlug\": \"products-price-for-each-store\", \"difficulty\": \"Easy\", \"translatedTitle\": \"\\u6bcf\\u5bb6\\u5546\\u5e97\\u7684\\u4ea7\\u54c1\\u4ef7\\u683c\", \"isPaidOnly\": true}, {\"title\": \"Dynamic Unpivoting of a Table\", \"titleSlug\": \"dynamic-unpivoting-of-a-table\", \"difficulty\": \"Hard\", \"translatedTitle\": \"\\u52a8\\u6001\\u53d6\\u6d88\\u8868\\u7684\\u65cb\\u8f6c\", \"isPaidOnly\": true}]",
|
||||
"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, \"cangjie\": false}",
|
||||
"langToValidPlayground": "{\"cpp\": false, \"java\": false, \"python3\": false, \"python\": false, \"javascript\": false, \"typescript\": false, \"csharp\": false, \"c\": false, \"golang\": false, \"kotlin\": false, \"swift\": false, \"rust\": false, \"ruby\": false, \"php\": false, \"dart\": false, \"scala\": false, \"elixir\": false, \"erlang\": false, \"racket\": false, \"cangjie\": false, \"bash\": false, \"html\": false, \"pythonml\": false, \"react\": false, \"vanillajs\": false, \"mysql\": false, \"mssql\": false, \"postgresql\": false, \"oraclesql\": false, \"pythondata\": false}",
|
||||
"topicTags": [
|
||||
{
|
||||
"name": "Database",
|
||||
@@ -40,6 +40,12 @@
|
||||
"code": "/* Write your T-SQL query statement below */",
|
||||
"__typename": "CodeSnippetNode"
|
||||
},
|
||||
{
|
||||
"lang": "PostgreSQL",
|
||||
"langSlug": "postgresql",
|
||||
"code": "-- Write your PostgreSQL query statement below",
|
||||
"__typename": "CodeSnippetNode"
|
||||
},
|
||||
{
|
||||
"lang": "Oracle",
|
||||
"langSlug": "oraclesql",
|
||||
@@ -51,15 +57,9 @@
|
||||
"langSlug": "pythondata",
|
||||
"code": "import pandas as pd\n\ndef rearrange_products_table(products: pd.DataFrame) -> pd.DataFrame:\n ",
|
||||
"__typename": "CodeSnippetNode"
|
||||
},
|
||||
{
|
||||
"lang": "PostgreSQL",
|
||||
"langSlug": "postgresql",
|
||||
"code": "-- Write your PostgreSQL query statement below",
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"56.4K\", \"totalSubmission\": \"71.6K\", \"totalAcceptedRaw\": 56431, \"totalSubmissionRaw\": 71639, \"acRate\": \"78.8%\"}",
|
||||
"stats": "{\"totalAccepted\": \"61.6K\", \"totalSubmission\": \"78K\", \"totalAcceptedRaw\": 61606, \"totalSubmissionRaw\": 78032, \"acRate\": \"78.9%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
Reference in New Issue
Block a user