1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode/originData/replace-employee-id-with-the-unique-identifier.json

101 lines
7.8 KiB
JSON
Raw Permalink Normal View History

2023-12-09 18:53:53 +08:00
{
"data": {
"question": {
"questionId": "1509",
"questionFrontendId": "1378",
"boundTopicId": null,
"title": "Replace Employee ID With The Unique Identifier",
"titleSlug": "replace-employee-id-with-the-unique-identifier",
"content": "<p>Table: <code>Employees</code></p>\n\n<pre>\n+---------------+---------+\n| Column Name | Type |\n+---------------+---------+\n| id | int |\n| name | varchar |\n+---------------+---------+\nid is the primary key (column with unique values) for this table.\nEach row of this table contains the id and the name of an employee in a company.\n</pre>\n\n<p>&nbsp;</p>\n\n<p>Table: <code>EmployeeUNI</code></p>\n\n<pre>\n+---------------+---------+\n| Column Name | Type |\n+---------------+---------+\n| id | int |\n| unique_id | int |\n+---------------+---------+\n(id, unique_id) is the primary key (combination of columns with unique values) for this table.\nEach row of this table contains the id and the corresponding unique id of an employee in the company.\n</pre>\n\n<p>&nbsp;</p>\n\n<p>Write a solution to show the <strong>unique ID </strong>of each user, If a user does not have a unique ID replace just show <code>null</code>.</p>\n\n<p>Return the result table in <strong>any</strong> order.</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> \nEmployees table:\n+----+----------+\n| id | name |\n+----+----------+\n| 1 | Alice |\n| 7 | Bob |\n| 11 | Meir |\n| 90 | Winston |\n| 3 | Jonathan |\n+----+----------+\nEmployeeUNI table:\n+----+-----------+\n| id | unique_id |\n+----+-----------+\n| 3 | 1 |\n| 11 | 2 |\n| 90 | 3 |\n+----+-----------+\n<strong>Output:</strong> \n+-----------+----------+\n| unique_id | name |\n+-----------+----------+\n| null | Alice |\n| null | Bob |\n| 2 | Meir |\n| 3 | Winston |\n| 1 | Jonathan |\n+-----------+----------+\n<strong>Explanation:</strong> \nAlice and Bob do not have a unique ID, We will show null instead.\nThe unique ID of Meir is 2.\nThe unique ID of Winston is 3.\nThe unique ID of Jonathan is 1.\n</pre>\n",
"translatedTitle": null,
"translatedContent": null,
"isPaidOnly": false,
"difficulty": "Easy",
2023-12-09 19:57:46 +08:00
"likes": 828,
2023-12-09 18:53:53 +08:00
"dislikes": 85,
"isLiked": null,
"similarQuestions": "[]",
"exampleTestcases": "{\"headers\":{\"Employees\":[\"id\",\"name\"],\"EmployeeUNI\":[\"id\",\"unique_id\"]},\"rows\":{\"Employees\":[[1,\"Alice\"],[7,\"Bob\"],[11,\"Meir\"],[90,\"Winston\"],[3,\"Jonathan\"]],\"EmployeeUNI\":[[3,1],[11,2],[90,3]]}}",
"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"
},
{
"lang": "Pandas",
"langSlug": "pythondata",
"code": "import pandas as pd\n\ndef replace_employee_id(employees: pd.DataFrame, employee_uni: pd.DataFrame) -> pd.DataFrame:\n ",
"__typename": "CodeSnippetNode"
},
{
"lang": "PostgreSQL",
"langSlug": "postgresql",
"code": "-- Write your PostgreSQL query statement below\n",
"__typename": "CodeSnippetNode"
}
],
2023-12-09 19:57:46 +08:00
"stats": "{\"totalAccepted\": \"222.7K\", \"totalSubmission\": \"269.5K\", \"totalAcceptedRaw\": 222651, \"totalSubmissionRaw\": 269497, \"acRate\": \"82.6%\"}",
2023-12-09 18:53:53 +08:00
"hints": [],
"solution": {
"id": "2017",
"canSeeDetail": false,
"paidOnly": true,
"hasVideoSolution": false,
"paidOnlyVideo": true,
"__typename": "ArticleNode"
},
"status": null,
"sampleTestCase": "{\"headers\":{\"Employees\":[\"id\",\"name\"],\"EmployeeUNI\":[\"id\",\"unique_id\"]},\"rows\":{\"Employees\":[[1,\"Alice\"],[7,\"Bob\"],[11,\"Meir\"],[90,\"Winston\"],[3,\"Jonathan\"]],\"EmployeeUNI\":[[3,1],[11,2],[90,3]]}}",
"metaData": "{\"mysql\": [\"Create table If Not Exists Employees (id int, name varchar(20))\", \"Create table If Not Exists EmployeeUNI (id int, unique_id int)\"], \"mssql\": [\"Create table Employees (id int, name varchar(20))\", \"Create table EmployeeUNI (id int, unique_id int)\"], \"oraclesql\": [\"Create table Employees (id int, name varchar(20))\", \"Create table EmployeeUNI (id int, unique_id int)\"], \"database\": true, \"name\": \"replace_employee_id\", \"pythondata\": [\"Employees = pd.DataFrame([], columns=['id', 'name']).astype({'id':'int64', 'name':'object'})\", \"EmployeeUNI = pd.DataFrame([], columns=['id', 'unique_id']).astype({'id':'int64', 'unique_id':'int64'})\"], \"postgresql\": [\"\\nCreate table If Not Exists Employees (id int, name varchar(20))\\n\", \"Create table If Not Exists EmployeeUNI (id int, unique_id int)\"], \"database_schema\": {\"Employees\": {\"id\": \"INT\", \"name\": \"VARCHAR(20)\"}, \"EmployeeUNI\": {\"id\": \"INT\", \"unique_id\": \"INT\"}}}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
"Create table If Not Exists Employees (id int, name varchar(20))",
"Create table If Not Exists EmployeeUNI (id int, unique_id int)",
"Truncate table Employees",
"insert into Employees (id, name) values ('1', 'Alice')",
"insert into Employees (id, name) values ('7', 'Bob')",
"insert into Employees (id, name) values ('11', 'Meir')",
"insert into Employees (id, name) values ('90', 'Winston')",
"insert into Employees (id, name) values ('3', 'Jonathan')",
"Truncate table EmployeeUNI",
"insert into EmployeeUNI (id, unique_id) values ('3', '1')",
"insert into EmployeeUNI (id, unique_id) values ('11', '2')",
"insert into EmployeeUNI (id, unique_id) values ('90', '3')"
],
"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>\"], \"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,
"__typename": "QuestionNode"
}
}
}