"content":"<p>Table: <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 is the primary key for this table.\nThe sex column is ENUM value of type ('m', 'f').\nThe table contains information about an employee.\n</pre>\n\n<p> </p>\n\n<p>Write an SQL query to swap all <code>'f'</code> and <code>'m'</code> values (i.e., change all <code>'f'</code> values to <code>'m'</code> and vice versa) with a <strong>single update statement</strong> and no intermediate temporary tables.</p>\n\n<p>Note that you must write a single update statement, <strong>do not</strong> write any select statement for this problem.</p>\n\n<p>The query result format is in the following example.</p>\n\n<p> </p>\n<p><strong>Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> \nSalary table:\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>Output:</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>Explanation:</strong> \n(1, A) and (3, C) were changed from 'm' to 'f'.\n(2, B) and (4, D) were changed from 'f' to 'm'.\n</pre>\n",
"translatedTitle":"变更性别",
"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",
"metaData":"{\n \"mysql\": [\n \"Create table If Not Exists Salary (id int, name varchar(100), sex char(1), salary int)\"\n ],\n \"mssql\": [\n \"Create table Salary (id int, name varchar(100), sex char(1), salary int)\"\n ],\n \"oraclesql\": [\n \"Create table Salary (id int, name varchar(100), sex char(1), salary int)\"\n ],\n \"database\": true,\n \"manual\": true\n}",
"judgerAvailable":true,
"judgeType":"large",
"mysqlSchemas":[
"Create table If Not Exists Salary (id int, name varchar(100), sex char(1), salary int)",