1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-05 23:41:41 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

存量题库数据更新

This commit is contained in:
2023-12-09 18:42:21 +08:00
parent a788808cd7
commit c198538f10
10843 changed files with 288489 additions and 248355 deletions

View File

@@ -6,13 +6,13 @@
"boundTopicId": null,
"title": "Swap Salary",
"titleSlug": "swap-salary",
"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 (&#39;m&#39;, &#39;f&#39;).\nThe table contains information about an employee.\n</pre>\n\n<p>&nbsp;</p>\n\n<p>Write an SQL query to swap all <code>&#39;f&#39;</code> and <code>&#39;m&#39;</code> values (i.e., change all <code>&#39;f&#39;</code> values to <code>&#39;m&#39;</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>&nbsp;</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 &#39;m&#39; to &#39;f&#39;.\n(2, B) and (4, D) were changed from &#39;f&#39; to &#39;m&#39;.\n</pre>\n",
"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 (column with unique values) for this table.\nThe sex column is ENUM (category) value of type (&#39;m&#39;, &#39;f&#39;).\nThe table contains information about an employee.\n</pre>\n\n<p>&nbsp;</p>\n\n<p>Write a solution to swap all <code>&#39;f&#39;</code> and <code>&#39;m&#39;</code> values (i.e., change all <code>&#39;f&#39;</code> values to <code>&#39;m&#39;</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 result format is in the following example.</p>\n\n<p>&nbsp;</p>\n<p><strong class=\"example\">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 &#39;m&#39; to &#39;f&#39;.\n(2, B) and (4, D) were changed from &#39;f&#39; to &#39;m&#39;.\n</pre>\n",
"translatedTitle": null,
"translatedContent": null,
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 867,
"dislikes": 496,
"likes": 1680,
"dislikes": 562,
"isLiked": null,
"similarQuestions": "[]",
"exampleTestcases": "{\"headers\":{\"Salary\":[\"id\",\"name\",\"sex\",\"salary\"]},\"rows\":{\"Salary\":[[1,\"A\",\"m\",2500],[2,\"B\",\"f\",1500],[3,\"C\",\"m\",5500],[4,\"D\",\"f\",500]]}}",
@@ -45,21 +45,33 @@
"langSlug": "oraclesql",
"code": "/* Write your PL/SQL query statement below */\n",
"__typename": "CodeSnippetNode"
},
{
"lang": "Pandas",
"langSlug": "pythondata",
"code": "import pandas as pd\n\ndef swap_salary(salary: pd.DataFrame) -> pd.DataFrame:\n ",
"__typename": "CodeSnippetNode"
},
{
"lang": "PostgreSQL",
"langSlug": "postgresql",
"code": "-- Write your PostgreSQL query statement below\n",
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"187.5K\", \"totalSubmission\": \"235.6K\", \"totalAcceptedRaw\": 187548, \"totalSubmissionRaw\": 235624, \"acRate\": \"79.6%\"}",
"stats": "{\"totalAccepted\": \"385.3K\", \"totalSubmission\": \"464.2K\", \"totalAcceptedRaw\": 385254, \"totalSubmissionRaw\": 464204, \"acRate\": \"83.0%\"}",
"hints": [],
"solution": {
"id": "177",
"canSeeDetail": true,
"paidOnly": false,
"canSeeDetail": false,
"paidOnly": true,
"hasVideoSolution": false,
"paidOnlyVideo": true,
"__typename": "ArticleNode"
},
"status": null,
"sampleTestCase": "{\"headers\":{\"Salary\":[\"id\",\"name\",\"sex\",\"salary\"]},\"rows\":{\"Salary\":[[1,\"A\",\"m\",2500],[2,\"B\",\"f\",1500],[3,\"C\",\"m\",5500],[4,\"D\",\"f\",500]]}}",
"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}",
"metaData": "{\"mysql\": [\"Create table If Not Exists Salary (id int, name varchar(100), sex char(1), salary int)\"], \"mssql\": [\"Create table Salary (id int, name varchar(100), sex char(1), salary int)\"], \"oraclesql\": [\"Create table Salary (id int, name varchar(100), sex char(1), salary int)\"], \"database\": true, \"manual\": true, \"name\": \"swap_salary\", \"pythondata\": [\"Salary = pd.DataFrame([], columns=['id', 'name', 'sex', 'salary']).astype({'id':'Int64', 'name':'object', 'sex':'object', 'salary':'Int64'})\\n\"], \"postgresql\": [\"Create table If Not Exists Salary (id int, name varchar, sex char, salary int)\\n\"], \"database_schema\": {\"Salary\": {\"id\": \"INT\", \"name\": \"VARCHAR(100)\", \"sex\": \"CHAR(1)\", \"salary\": \"INT\"}}}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
@@ -73,7 +85,7 @@
"enableRunCode": true,
"enableTestMode": false,
"enableDebugger": false,
"envInfo": "{\"mysql\": [\"MySQL\", \"<p><code>MySQL 8.0</code>.</p>\"], \"mssql\": [\"MS SQL Server\", \"<p><code>mssql server 2019</code>.</p>\"], \"oraclesql\": [\"Oracle\", \"<p><code>Oracle Sql 11.2</code>.</p>\"]}",
"envInfo": "{\"mysql\": [\"MySQL\", \"<p><code>MySQL 8.0</code>.</p>\"], \"mssql\": [\"MS SQL Server\", \"<p><code>mssql server 2019</code>.</p>\"], \"oraclesql\": [\"Oracle\", \"<p><code>Oracle Sql 11.2</code>.</p>\"], \"pythondata\": [\"Pandas\", \"<p>Python 3.10 with Pandas 2.0.2 and NumPy 1.25.0</p>\"], \"postgresql\": [\"PostgreSQL\", \"<p>PostgreSQL 16</p>\"]}",
"libraryUrl": null,
"adminUrl": null,
"challengeQuestion": null,