2022-03-27 18:35:17 +08:00
{
"data" : {
"question" : {
"questionId" : "183" ,
"questionFrontendId" : "183" ,
"boundTopicId" : null ,
"title" : "Customers Who Never Order" ,
"titleSlug" : "customers-who-never-order" ,
2023-12-09 18:42:21 +08:00
"content" : "<p>Table: <code>Customers</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 indicates the ID and name of a customer.\n</pre>\n\n<p> </p>\n\n<p>Table: <code>Orders</code></p>\n\n<pre>\n+-------------+------+\n| Column Name | Type |\n+-------------+------+\n| id | int |\n| customerId | int |\n+-------------+------+\nid is the primary key (column with unique values) for this table.\ncustomerId is a foreign key (reference columns) of the ID from the Customers table.\nEach row of this table indicates the ID of an order and the ID of the customer who ordered it.\n</pre>\n\n<p> </p>\n\n<p>Write a solution to find all customers who never order anything.</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> \nCustomers table:\n+----+-------+\n| id | name |\n+----+-------+\n| 1 | Joe |\n| 2 | Henry |\n| 3 | Sam |\n| 4 | Max |\n+----+-------+\nOrders table:\n+----+------------+\n| id | customerId |\n+----+------------+\n| 1 | 3 |\n| 2 | 1 |\n+----+------------+\n<strong>Output:</strong> \n+-----------+\n| Customers |\n+-----------+\n| Henry |\n| Max |\n+-----------+\n</pre>\n" ,
2022-03-27 18:35:17 +08:00
"translatedTitle" : null ,
"translatedContent" : null ,
"isPaidOnly" : false ,
"difficulty" : "Easy" ,
2023-12-09 18:42:21 +08:00
"likes" : 2514 ,
"dislikes" : 125 ,
2022-03-27 18:35:17 +08:00
"isLiked" : null ,
"similarQuestions" : "[]" ,
"exampleTestcases" : "{\"headers\": {\"Customers\": [\"id\", \"name\"], \"Orders\": [\"id\", \"customerId\"]}, \"rows\": {\"Customers\": [[1, \"Joe\"], [2, \"Henry\"], [3, \"Sam\"], [4, \"Max\"]], \"Orders\": [[1, 3], [2, 1]]}}" ,
"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"
2023-12-09 18:42:21 +08:00
} ,
{
"lang" : "Pandas" ,
"langSlug" : "pythondata" ,
"code" : "import pandas as pd\n\ndef find_customers(customers: pd.DataFrame, orders: pd.DataFrame) -> pd.DataFrame:\n " ,
"__typename" : "CodeSnippetNode"
} ,
{
"lang" : "PostgreSQL" ,
"langSlug" : "postgresql" ,
"code" : "-- Write your PostgreSQL query statement below\n" ,
"__typename" : "CodeSnippetNode"
2022-03-27 18:35:17 +08:00
}
] ,
2023-12-09 19:57:46 +08:00
"stats" : "{\"totalAccepted\": \"741.2K\", \"totalSubmission\": \"1.1M\", \"totalAcceptedRaw\": 741171, \"totalSubmissionRaw\": 1079960, \"acRate\": \"68.6%\"}" ,
2022-03-27 18:35:17 +08:00
"hints" : [ ] ,
"solution" : {
"id" : "218" ,
2023-12-09 18:42:21 +08:00
"canSeeDetail" : false ,
"paidOnly" : true ,
2022-03-27 18:35:17 +08:00
"hasVideoSolution" : false ,
"paidOnlyVideo" : true ,
"__typename" : "ArticleNode"
} ,
"status" : null ,
"sampleTestCase" : "{\"headers\": {\"Customers\": [\"id\", \"name\"], \"Orders\": [\"id\", \"customerId\"]}, \"rows\": {\"Customers\": [[1, \"Joe\"], [2, \"Henry\"], [3, \"Sam\"], [4, \"Max\"]], \"Orders\": [[1, 3], [2, 1]]}}" ,
2023-12-09 18:42:21 +08:00
"metaData" : "{\"mysql\": [\"Create table If Not Exists Customers (id int, name varchar(255))\", \"Create table If Not Exists Orders (id int, customerId int)\"], \"mssql\": [\"Create table Customers (id int, name varchar(255))\", \"Create table Orders (id int, customerId int)\"], \"oraclesql\": [\"Create table Customers (id int, name varchar(255))\", \"Create table Orders (id int, customerId int)\"], \"database\": true, \"name\": \"find_customers\", \"pythondata\": [\"Customers = pd.DataFrame([], columns=['id', 'name']).astype({'id':'Int64', 'name':'object'})\", \"Orders = pd.DataFrame([], columns=['id', 'customerId']).astype({'id':'Int64', 'customerId':'Int64'})\"], \"manual\": false, \"postgresql\": [\"Create table If Not Exists Customers (id int, name varchar(255))\", \"Create table If Not Exists Orders (id int, customerId int)\"], \"database_schema\": {\"Customers\": {\"id\": \"INT\", \"name\": \"VARCHAR(255)\"}, \"Orders\": {\"id\": \"INT\", \"customerId\": \"INT\"}}}" ,
2022-03-27 18:35:17 +08:00
"judgerAvailable" : true ,
"judgeType" : "large" ,
"mysqlSchemas" : [
"Create table If Not Exists Customers (id int, name varchar(255))" ,
"Create table If Not Exists Orders (id int, customerId int)" ,
"Truncate table Customers" ,
"insert into Customers (id, name) values ('1', 'Joe')" ,
"insert into Customers (id, name) values ('2', 'Henry')" ,
"insert into Customers (id, name) values ('3', 'Sam')" ,
"insert into Customers (id, name) values ('4', 'Max')" ,
"Truncate table Orders" ,
"insert into Orders (id, customerId) values ('1', '3')" ,
"insert into Orders (id, customerId) values ('2', '1')"
] ,
"enableRunCode" : true ,
"enableTestMode" : false ,
"enableDebugger" : false ,
2023-12-09 18:42:21 +08:00
"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>\"]}" ,
2022-03-27 18:35:17 +08:00
"libraryUrl" : null ,
"adminUrl" : null ,
"challengeQuestion" : null ,
"__typename" : "QuestionNode"
}
}
}