mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-06 16:01:41 +08:00
批量更新数据
This commit is contained in:
@@ -12,12 +12,12 @@
|
||||
"translatedContent": "<p>表:<code>Employee</code></p>\n\n<pre>\n+---------------+---------+\n| Column Name | Type |\n+---------------+---------+\n| employee_id | int |\n| department_id | int |\n| primary_flag | varchar |\n+---------------+---------+\n这张表的主键为 employee_id, department_id (具有唯一值的列的组合)\nemployee_id 是员工的ID\ndepartment_id 是部门的ID,表示员工与该部门有关系\nprimary_flag 是一个枚举类型,值分别为('Y', 'N'). 如果值为'Y',表示该部门是员工的直属部门。 如果值是'N',则否\n</pre>\n\n<p> </p>\n\n<p>一个员工可以属于多个部门。当一个员工加入<strong>超过一个部门</strong>的时候,他需要决定哪个部门是他的直属部门。请注意,当员工只加入一个部门的时候,那这个部门将默认为他的直属部门,虽然表记录的值为<code>'N'</code>.</p>\n\n<p>请编写解决方案,查出员工所属的直属部门。</p>\n\n<p>返回结果 <strong>没有顺序要求</strong> 。</p>\n\n<p>返回结果格式如下例子所示:</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>\nEmployee table:\n+-------------+---------------+--------------+\n| employee_id | department_id | primary_flag |\n+-------------+---------------+--------------+\n| 1 | 1 | N |\n| 2 | 1 | Y |\n| 2 | 2 | N |\n| 3 | 3 | N |\n| 4 | 2 | N |\n| 4 | 3 | Y |\n| 4 | 4 | N |\n+-------------+---------------+--------------+\n<strong>输出:</strong>\n+-------------+---------------+\n| employee_id | department_id |\n+-------------+---------------+\n| 1 | 1 |\n| 2 | 1 |\n| 3 | 3 |\n| 4 | 3 |\n+-------------+---------------+\n<strong>解释:</strong>\n- 员工 1 的直属部门是 1\n- 员工 2 的直属部门是 1\n- 员工 3 的直属部门是 3\n- 员工 4 的直属部门是 3</pre>\n\n<p> </p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Easy",
|
||||
"likes": 44,
|
||||
"likes": 80,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"contributors": [],
|
||||
"langToValidPlayground": "{\"cpp\": false, \"java\": false, \"python\": false, \"python3\": false, \"mysql\": false, \"mssql\": false, \"oraclesql\": false, \"c\": false, \"csharp\": false, \"javascript\": false, \"typescript\": false, \"bash\": false, \"php\": false, \"swift\": false, \"kotlin\": false, \"dart\": false, \"golang\": false, \"ruby\": false, \"scala\": false, \"html\": false, \"pythonml\": false, \"rust\": false, \"racket\": false, \"erlang\": false, \"elixir\": false, \"pythondata\": false, \"react\": false, \"vanillajs\": false, \"postgresql\": false}",
|
||||
"langToValidPlayground": "{\"cpp\": false, \"java\": false, \"python\": false, \"python3\": false, \"mysql\": false, \"mssql\": false, \"oraclesql\": false, \"c\": false, \"csharp\": false, \"javascript\": false, \"typescript\": false, \"bash\": false, \"php\": false, \"swift\": false, \"kotlin\": false, \"dart\": false, \"golang\": false, \"ruby\": false, \"scala\": false, \"html\": false, \"pythonml\": false, \"rust\": false, \"racket\": false, \"erlang\": false, \"elixir\": false, \"pythondata\": false, \"react\": false, \"vanillajs\": false, \"postgresql\": false, \"cangjie\": false}",
|
||||
"topicTags": [
|
||||
{
|
||||
"name": "Database",
|
||||
@@ -59,12 +59,12 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"15.3K\", \"totalSubmission\": \"22.9K\", \"totalAcceptedRaw\": 15325, \"totalSubmissionRaw\": 22867, \"acRate\": \"67.0%\"}",
|
||||
"stats": "{\"totalAccepted\": \"39.8K\", \"totalSubmission\": \"56.4K\", \"totalAcceptedRaw\": 39812, \"totalSubmissionRaw\": 56404, \"acRate\": \"70.6%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
"sampleTestCase": "{\"headers\":{\"Employee\":[\"employee_id\",\"department_id\",\"primary_flag\"]},\"rows\":{\"Employee\":[[\"1\",\"1\",\"N\"],[\"2\",\"1\",\"Y\"],[\"2\",\"2\",\"N\"],[\"3\",\"3\",\"N\"],[\"4\",\"2\",\"N\"],[\"4\",\"3\",\"Y\"],[\"4\",\"4\",\"N\"]]}}",
|
||||
"metaData": "{\"mysql\":[\"Create table If Not Exists Employee (employee_id int, department_id int, primary_flag ENUM('Y','N'))\"],\"mssql\":[\"Create table Employee (employee_id int, department_id int, primary_flag varchar(1) not null check(primary_flag in ('Y', 'N')))\"],\"oraclesql\":[\"Create table Employee (employee_id int, department_id int, primary_flag varchar(1) not null check(primary_flag in ('Y', 'N')))\"],\"database\":true,\"name\":\"find_primary_department\",\"pythondata\":[\"Employee = pd.DataFrame([], columns=['employee_id', 'department_id', 'primary_flag']).astype({'employee_id':'Int64', 'department_id':'Int64', 'primary_flag':'object'})\"],\"postgresql\":[\"Create table If Not Exists Employee (employee_id int, department_id int, primary_flag VARCHAR(30) CHECK (primary_flag IN ('Y','N')))\\n\"],\"database_schema\":{\"Employee\":{\"employee_id\":\"INT\",\"department_id\":\"INT\",\"primary_flag\":\"ENUM('Y', 'N')\"}}}",
|
||||
"metaData": "{\"mysql\":[\"Create table If Not Exists Employee (employee_id int, department_id int, primary_flag ENUM('Y','N'))\"],\"mssql\":[\"Create table Employee (employee_id int, department_id int, primary_flag varchar(1) not null check(primary_flag in ('Y', 'N')))\"],\"oraclesql\":[\"Create table Employee (employee_id int, department_id int, primary_flag varchar(1) not null check(primary_flag in ('Y', 'N')))\"],\"database\":true,\"name\":\"find_primary_department\",\"pythondata\":[\"Employee = pd.DataFrame([], columns=['employee_id', 'department_id', 'primary_flag']).astype({'employee_id':'Int64', 'department_id':'Int64', 'primary_flag':'object'})\"],\"postgresql\":[\"Create table If Not Exists Employee (employee_id int, department_id int, primary_flag VARCHAR(30) CHECK (primary_flag IN ('Y','N')))\\n\"],\"manual\":false,\"database_schema\":{\"Employee\":{\"employee_id\":\"INT\",\"department_id\":\"INT\",\"primary_flag\":\"ENUM('Y', 'N')\"}}}",
|
||||
"judgerAvailable": true,
|
||||
"judgeType": "large",
|
||||
"mysqlSchemas": [
|
||||
@@ -79,7 +79,7 @@
|
||||
"insert into Employee (employee_id, department_id, primary_flag) values ('4', '4', 'N')"
|
||||
],
|
||||
"enableRunCode": true,
|
||||
"envInfo": "{\"mysql\":[\"MySQL\",\"<p>\\u7248\\u672c\\uff1a<code>MySQL 8.0<\\/code><\\/p>\"],\"mssql\":[\"MS SQL Server\",\"<p>mssql server 2019.<\\/p>\"],\"oraclesql\":[\"Oracle\",\"<p>Oracle Sql 11.2.<\\/p>\"],\"pythondata\":[\"Pandas\",\"<p>Python 3.10 with Pandas 2.0.2 and NumPy 1.25.0<\\/p>\"],\"postgresql\":[\"PostgreSQL\",\"<p>PostgreSQL 16<\\/p>\"]}",
|
||||
"envInfo": "{\"mysql\":[\"MySQL\",\"<p>\\u7248\\u672c\\uff1a<code>MySQL 8.0<\\/code><\\/p>\"],\"mssql\":[\"MS SQL Server\",\"<p>mssql server 2019.<\\/p>\"],\"oraclesql\":[\"Oracle\",\"<p>Oracle Sql 11.2.<\\/p>\"],\"pythondata\":[\"Pandas\",\"<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4<\\/p>\"],\"postgresql\":[\"PostgreSQL\",\"<p>PostgreSQL 16<\\/p>\"]}",
|
||||
"book": null,
|
||||
"isSubscribed": false,
|
||||
"isDailyQuestion": false,
|
||||
|
Reference in New Issue
Block a user