mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-02 22:13:28 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<div class=\"original__bRMd\">\n<div>\n<p><code>Salary</code> 表:</p>\n\n<pre>\n+-------------+----------+\n| Column Name | Type |\n+-------------+----------+\n| id | int |\n| name | varchar |\n| sex | ENUM |\n| salary | int |\n+-------------+----------+\nid 是这个表的主键。\nsex 这一列的值是 ENUM 类型,只能从 ('m', 'f') 中取。\n本表包含公司雇员的信息。\n</pre>\n\n<p> </p>\n\n<p>请你编写一个 SQL 查询来交换所有的 <code>'f'</code> 和 <code>'m'</code> (即,将所有 <code>'f'</code> 变为 <code>'m'</code> ,反之亦然),仅使用 <strong>单个 update 语句</strong> ,且不产生中间临时表。</p>\n\n<p>注意,你必须仅使用一条 update 语句,且 <strong>不能</strong> 使用 select 语句。</p>\n\n<p>查询结果如下例所示。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>\nSalary 表:\n+----+------+-----+--------+\n| id | name | sex | salary |\n+----+------+-----+--------+\n| 1 | A | m | 2500 |\n| 2 | B | f | 1500 |\n| 3 | C | m | 5500 |\n| 4 | D | f | 500 |\n+----+------+-----+--------+\n<strong>输出:</strong>\n+----+------+-----+--------+\n| id | name | sex | salary |\n+----+------+-----+--------+\n| 1 | A | f | 2500 |\n| 2 | B | m | 1500 |\n| 3 | C | f | 5500 |\n| 4 | D | m | 500 |\n+----+------+-----+--------+\n<strong>解释:</strong>\n(1, A) 和 (3, C) 从 'm' 变为 'f' 。\n(2, B) 和 (4, D) 从 'f' 变为 'm' 。</pre>\n</div>\n</div>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Easy",
|
||||
"likes": 292,
|
||||
"likes": 306,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -47,7 +47,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"97.2K\", \"totalSubmission\": \"120K\", \"totalAcceptedRaw\": 97233, \"totalSubmissionRaw\": 119991, \"acRate\": \"81.0%\"}",
|
||||
"stats": "{\"totalAccepted\": \"104.8K\", \"totalSubmission\": \"128.6K\", \"totalAcceptedRaw\": 104760, \"totalSubmissionRaw\": 128648, \"acRate\": \"81.4%\"}",
|
||||
"hints": [],
|
||||
"solution": {
|
||||
"id": "93",
|
||||
|
Reference in New Issue
Block a user