代码拉取完成,页面将自动刷新
{
"data": {
"question": {
"questionId": "175",
"questionFrontendId": "175",
"boundTopicId": null,
"title": "Combine Two Tables",
"titleSlug": "combine-two-tables",
"content": "<p>Table: <code>Person</code></p>\n\n<pre>\n+-------------+---------+\n| Column Name | Type |\n+-------------+---------+\n| personId | int |\n| lastName | varchar |\n| firstName | varchar |\n+-------------+---------+\npersonId is the primary key (column with unique values) for this table.\nThis table contains information about the ID of some persons and their first and last names.\n</pre>\n\n<p> </p>\n\n<p>Table: <code>Address</code></p>\n\n<pre>\n+-------------+---------+\n| Column Name | Type |\n+-------------+---------+\n| addressId | int |\n| personId | int |\n| city | varchar |\n| state | varchar |\n+-------------+---------+\naddressId is the primary key (column with unique values) for this table.\nEach row of this table contains information about the city and state of one person with ID = PersonId.\n</pre>\n\n<p> </p>\n\n<p>Write a solution to report the first name, last name, city, and state of each person in the <code>Person</code> table. If the address of a <code>personId</code> is not present in the <code>Address</code> table, report <code>null</code> instead.</p>\n\n<p>Return the result table in <strong>any order</strong>.</p>\n\n<p>The result format is in the following example.</p>\n\n<p> </p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> \nPerson table:\n+----------+----------+-----------+\n| personId | lastName | firstName |\n+----------+----------+-----------+\n| 1 | Wang | Allen |\n| 2 | Alice | Bob |\n+----------+----------+-----------+\nAddress table:\n+-----------+----------+---------------+------------+\n| addressId | personId | city | state |\n+-----------+----------+---------------+------------+\n| 1 | 2 | New York City | New York |\n| 2 | 3 | Leetcode | California |\n+-----------+----------+---------------+------------+\n<strong>Output:</strong> \n+-----------+----------+---------------+----------+\n| firstName | lastName | city | state |\n+-----------+----------+---------------+----------+\n| Allen | Wang | Null | Null |\n| Bob | Alice | New York City | New York |\n+-----------+----------+---------------+----------+\n<strong>Explanation:</strong> \nThere is no address in the address table for the personId = 1 so we return null in their city and state.\naddressId = 1 contains information about the address of personId = 2.\n</pre>\n",
"translatedTitle": null,
"translatedContent": null,
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 3332,
"dislikes": 219,
"isLiked": null,
"similarQuestions": "[{\"title\": \"Employee Bonus\", \"titleSlug\": \"employee-bonus\", \"difficulty\": \"Easy\", \"translatedTitle\": null}]",
"exampleTestcases": "{\"headers\":{\"Person\":[\"personId\",\"lastName\",\"firstName\"],\"Address\":[\"addressId\",\"personId\",\"city\",\"state\"]},\"rows\":{\"Person\":[[1,\"Wang\",\"Allen\"],[2,\"Alice\",\"Bob\"]],\"Address\":[[1,2,\"New York City\",\"New York\"],[2,3,\"Leetcode\",\"California\"]]}}",
"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 combine_two_tables(person: pd.DataFrame, address: pd.DataFrame) -> pd.DataFrame:\n ",
"__typename": "CodeSnippetNode"
},
{
"lang": "PostgreSQL",
"langSlug": "postgresql",
"code": "-- Write your PostgreSQL query statement below\n",
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"914.8K\", \"totalSubmission\": \"1.2M\", \"totalAcceptedRaw\": 914766, \"totalSubmissionRaw\": 1217704, \"acRate\": \"75.1%\"}",
"hints": [],
"solution": {
"id": "206",
"canSeeDetail": true,
"paidOnly": false,
"hasVideoSolution": false,
"paidOnlyVideo": true,
"__typename": "ArticleNode"
},
"status": null,
"sampleTestCase": "{\"headers\":{\"Person\":[\"personId\",\"lastName\",\"firstName\"],\"Address\":[\"addressId\",\"personId\",\"city\",\"state\"]},\"rows\":{\"Person\":[[1,\"Wang\",\"Allen\"],[2,\"Alice\",\"Bob\"]],\"Address\":[[1,2,\"New York City\",\"New York\"],[2,3,\"Leetcode\",\"California\"]]}}",
"metaData": "{\"mysql\": [\"Create table If Not Exists Person (personId int, firstName varchar(255), lastName varchar(255))\", \"Create table If Not Exists Address (addressId int, personId int, city varchar(255), state varchar(255))\"], \"mssql\": [\"Create table Person (personId int, firstName varchar(255), lastName varchar(255))\", \"Create table Address (addressId int, personId int, city varchar(255), state varchar(255))\"], \"oraclesql\": [\"Create table Person (personId int, firstName varchar(255), lastName varchar(255))\", \"Create table Address (addressId int, personId int, city varchar(255), state varchar(255))\"], \"database\": true, \"name\": \"combine_two_tables\", \"pythondata\": [\"Person = pd.DataFrame([], columns=['personId', 'firstName', 'lastName']).astype({'personId':'Int64', 'firstName':'object', 'lastName':'object'})\", \"Address = pd.DataFrame([], columns=['addressId', 'personId', 'city', 'state']).astype({'addressId':'Int64', 'personId':'Int64', 'city':'object', 'state':'object'})\"], \"manual\": true, \"database_schema\": {\"Person\": {\"personId\": \"INT\", \"firstName\": \"VARCHAR(255)\", \"lastName\": \"VARCHAR(255)\"}, \"Address\": {\"addressId\": \"INT\", \"personId\": \"INT\", \"city\": \"VARCHAR(255)\", \"state\": \"VARCHAR(255)\"}}}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
"Create table If Not Exists Person (personId int, firstName varchar(255), lastName varchar(255))",
"Create table If Not Exists Address (addressId int, personId int, city varchar(255), state varchar(255))",
"Truncate table Person",
"insert into Person (personId, lastName, firstName) values ('1', 'Wang', 'Allen')",
"insert into Person (personId, lastName, firstName) values ('2', 'Alice', 'Bob')",
"Truncate table Address",
"insert into Address (addressId, personId, city, state) values ('1', '2', 'New York City', 'New York')",
"insert into Address (addressId, personId, city, state) values ('2', '3', 'Leetcode', 'California')"
],
"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"
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。