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-cn/originData/find-customer-referee.json
2022-03-29 16:56:27 +08:00

83 lines
6.4 KiB
JSON

{
"data": {
"question": {
"questionId": "584",
"questionFrontendId": "584",
"categoryTitle": "Database",
"boundTopicId": 2644,
"title": "Find Customer Referee",
"titleSlug": "find-customer-referee",
"content": "<p>Table: <code>Customer</code></p>\n\n<pre>\n+-------------+---------+\n| Column Name | Type |\n+-------------+---------+\n| id | int |\n| name | varchar |\n| referee_id | int |\n+-------------+---------+\nid is the primary key column for this table.\nEach row of this table indicates the id of a customer, their name, and the id of the customer who referred them.\n</pre>\n\n<p>&nbsp;</p>\n\n<p>Write an SQL query to report the IDs of the customer that are <strong>not referred by</strong> the customer with <code>id = 2</code>.</p>\n\n<p>Return the result table in <strong>any 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> \nCustomer table:\n+----+------+------------+\n| id | name | referee_id |\n+----+------+------------+\n| 1 | Will | null |\n| 2 | Jane | null |\n| 3 | Alex | 2 |\n| 4 | Bill | null |\n| 5 | Zack | 1 |\n| 6 | Mark | 2 |\n+----+------+------------+\n<strong>Output:</strong> \n+------+\n| name |\n+------+\n| Will |\n| Jane |\n| Bill |\n| Zack |\n+------+\n</pre>\n",
"translatedTitle": "寻找用户推荐人",
"translatedContent": "<p>给定表 <code>customer</code> ,里面保存了所有客户信息和他们的推荐人。</p>\n\n<pre>\n+------+------+-----------+\n| id | name | referee_id|\n+------+------+-----------+\n| 1 | Will | NULL |\n| 2 | Jane | NULL |\n| 3 | Alex | 2 |\n| 4 | Bill | NULL |\n| 5 | Zack | 1 |\n| 6 | Mark | 2 |\n+------+------+-----------+\n</pre>\n\n<p>写一个查询语句,返回一个客户列表,列表中客户的推荐人的编号都 <strong>不是 </strong>2。</p>\n\n<p>对于上面的示例数据,结果为:</p>\n\n<pre>\n+------+\n| name |\n+------+\n| Will |\n| Jane |\n| Bill |\n| Zack |\n+------+\n</pre>\n",
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 25,
"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, \"ruby\": false, \"bash\": false, \"swift\": false, \"golang\": false, \"scala\": false, \"html\": false, \"pythonml\": false, \"kotlin\": false, \"rust\": false, \"php\": false, \"typescript\": false, \"racket\": false, \"erlang\": false, \"elixir\": false}",
"topicTags": [
{
"name": "Database",
"slug": "database",
"translatedName": "数据库",
"__typename": "TopicTagNode"
}
],
"companyTagStats": null,
"codeSnippets": [
{
"lang": "MySQL",
"langSlug": "mysql",
"code": "# Write your MySQL query statement below",
"__typename": "CodeSnippetNode"
},
{
"lang": "MS SQL Server",
"langSlug": "mssql",
"code": "/* Write your T-SQL query statement below */",
"__typename": "CodeSnippetNode"
},
{
"lang": "Oracle",
"langSlug": "oraclesql",
"code": "/* Write your PL/SQL query statement below */",
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"19.1K\", \"totalSubmission\": \"24.7K\", \"totalAcceptedRaw\": 19082, \"totalSubmissionRaw\": 24721, \"acRate\": \"77.2%\"}",
"hints": [
"Be careful of the NULL value"
],
"solution": null,
"status": null,
"sampleTestCase": "{\"headers\":{\"Customer\":[\"id\",\"name\",\"referee_id\"]},\"rows\":{\"Customer\":[[1,\"Will\",null],[2,\"Jane\",null],[3,\"Alex\",2],[4,\"Bill\",null],[5,\"Zack\",1],[6,\"Mark\",2]]}}",
"metaData": "{\n \"mysql\": [\n \"Create table If Not Exists Customer (id int, name varchar(25), referee_id int)\"\n ],\n \"mssql\": [\n \"Create table Customer (id int, name varchar(25), referee_id int)\"\n ],\n \"oraclesql\": [\n \"Create table Customer (id int, name varchar(25), referee_id int)\"\n ],\n \"database\": true\n}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
"Create table If Not Exists Customer (id int, name varchar(25), referee_id int)",
"Truncate table Customer",
"insert into Customer (id, name, referee_id) values ('1', 'Will', 'None')",
"insert into Customer (id, name, referee_id) values ('2', 'Jane', 'None')",
"insert into Customer (id, name, referee_id) values ('3', 'Alex', '2')",
"insert into Customer (id, name, referee_id) values ('4', 'Bill', 'None')",
"insert into Customer (id, name, referee_id) values ('5', 'Zack', '1')",
"insert into Customer (id, name, referee_id) values ('6', 'Mark', '2')"
],
"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>\"]}",
"book": null,
"isSubscribed": false,
"isDailyQuestion": false,
"dailyRecordStatus": null,
"editorType": "CKEDITOR",
"ugcQuestionId": null,
"style": "LEETCODE",
"exampleTestcases": "{\"headers\":{\"Customer\":[\"id\",\"name\",\"referee_id\"]},\"rows\":{\"Customer\":[[1,\"Will\",null],[2,\"Jane\",null],[3,\"Alex\",2],[4,\"Bill\",null],[5,\"Zack\",1],[6,\"Mark\",2]]}}",
"__typename": "QuestionNode"
}
}
}