1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode/originData/exchange-seats.json
2022-05-02 23:44:12 +08:00

84 lines
5.1 KiB
JSON

{
"data": {
"question": {
"questionId": "626",
"questionFrontendId": "626",
"boundTopicId": null,
"title": "Exchange Seats",
"titleSlug": "exchange-seats",
"content": "<p>Table: <code>Seat</code></p>\n\n<pre>\n+-------------+---------+\n| Column Name | Type |\n+-------------+---------+\n| id | int |\n| name | varchar |\n+-------------+---------+\nid is the primary key column for this table.\nEach row of this table indicates the name and the ID of a student.\nid is a continuous increment.\n</pre>\n\n<p>&nbsp;</p>\n\n<p>Write an SQL query to swap the seat id of every two consecutive students. If the number of students is odd, the id of the last student is not swapped.</p>\n\n<p>Return the result table ordered by <code>id</code> <strong>in ascending order</strong>.</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> \nSeat table:\n+----+---------+\n| id | student |\n+----+---------+\n| 1 | Abbot |\n| 2 | Doris |\n| 3 | Emerson |\n| 4 | Green |\n| 5 | Jeames |\n+----+---------+\n<strong>Output:</strong> \n+----+---------+\n| id | student |\n+----+---------+\n| 1 | Doris |\n| 2 | Abbot |\n| 3 | Green |\n| 4 | Emerson |\n| 5 | Jeames |\n+----+---------+\n<strong>Explanation:</strong> \nNote that if the number of students is odd, there is no need to change the last one&#39;s seat.\n</pre>\n",
"translatedTitle": null,
"translatedContent": null,
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 656,
"dislikes": 354,
"isLiked": null,
"similarQuestions": "[]",
"exampleTestcases": "{\"headers\": {\"Seat\": [\"id\",\"student\"]}, \"rows\": {\"Seat\": [[1,\"Abbot\"],[2,\"Doris\"],[3,\"Emerson\"],[4,\"Green\"],[5,\"Jeames\"]]}}",
"categoryTitle": "Database",
"contributors": [],
"topicTags": [
{
"name": "Database",
"slug": "database",
"translatedName": null,
"__typename": "TopicTagNode"
}
],
"companyTagStats": null,
"codeSnippets": [
{
"lang": "MySQL",
"langSlug": "mysql",
"code": "# Write your MySQL query statement below\n",
"__typename": "CodeSnippetNode"
},
{
"lang": "MS SQL Server",
"langSlug": "mssql",
"code": "/* Write your T-SQL query statement below */\n",
"__typename": "CodeSnippetNode"
},
{
"lang": "Oracle",
"langSlug": "oraclesql",
"code": "/* Write your PL/SQL query statement below */\n",
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"100.5K\", \"totalSubmission\": \"145.2K\", \"totalAcceptedRaw\": 100517, \"totalSubmissionRaw\": 145181, \"acRate\": \"69.2%\"}",
"hints": [],
"solution": {
"id": "195",
"canSeeDetail": true,
"paidOnly": false,
"hasVideoSolution": false,
"paidOnlyVideo": true,
"__typename": "ArticleNode"
},
"status": null,
"sampleTestCase": "{\"headers\": {\"Seat\": [\"id\",\"student\"]}, \"rows\": {\"Seat\": [[1,\"Abbot\"],[2,\"Doris\"],[3,\"Emerson\"],[4,\"Green\"],[5,\"Jeames\"]]}}",
"metaData": "{\n \"mysql\": [\n \"Create table If Not Exists Seat (id int, student varchar(255))\"\n ],\n \"mssql\": [\n \"Create table Seat (id int, student varchar(255))\"\n ],\n \"oraclesql\": [\n \"Create table Seat (id int, student varchar(255))\"\n ],\n \"database\": true\n}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
"Create table If Not Exists Seat (id int, student varchar(255))",
"Truncate table Seat",
"insert into Seat (id, student) values ('1', 'Abbot')",
"insert into Seat (id, student) values ('2', 'Doris')",
"insert into Seat (id, student) values ('3', 'Emerson')",
"insert into Seat (id, student) values ('4', 'Green')",
"insert into Seat (id, student) values ('5', 'Jeames')"
],
"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>\"]}",
"libraryUrl": null,
"adminUrl": null,
"challengeQuestion": null,
"__typename": "QuestionNode"
}
}
}