From 5fe52a391d1e153c4f4346176865f64c24fe6f61 Mon Sep 17 00:00:00 2001 From: Deven <63876261+devenperez@users.noreply.github.com> Date: Fri, 20 Jan 2023 20:50:06 -0500 Subject: [PATCH] Create README - LeetHub --- 183-customers-who-never-order/README.md | 64 +++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 183-customers-who-never-order/README.md diff --git a/183-customers-who-never-order/README.md b/183-customers-who-never-order/README.md new file mode 100644 index 0000000..be17916 --- /dev/null +++ b/183-customers-who-never-order/README.md @@ -0,0 +1,64 @@ +

183. Customers Who Never Order

Easy


SQL Schema

Table: Customers

+ +
+-------------+---------+
+| Column Name | Type    |
++-------------+---------+
+| id          | int     |
+| name        | varchar |
++-------------+---------+
+id is the primary key column for this table.
+Each row of this table indicates the ID and name of a customer.
+
+ +

 

+ +

Table: Orders

+ +
+-------------+------+
+| Column Name | Type |
++-------------+------+
+| id          | int  |
+| customerId  | int  |
++-------------+------+
+id is the primary key column for this table.
+customerId is a foreign key of the ID from the Customers table.
+Each row of this table indicates the ID of an order and the ID of the customer who ordered it.
+
+ +

 

+ +

Write an SQL query to report all customers who never order anything.

+ +

Return the result table in any order.

+ +

The query result format is in the following example.

+ +

 

+

Example 1:

+ +
Input: 
+Customers table:
++----+-------+
+| id | name  |
++----+-------+
+| 1  | Joe   |
+| 2  | Henry |
+| 3  | Sam   |
+| 4  | Max   |
++----+-------+
+Orders table:
++----+------------+
+| id | customerId |
++----+------------+
+| 1  | 3          |
+| 2  | 1          |
++----+------------+
+Output: 
++-----------+
+| Customers |
++-----------+
+| Henry     |
+| Max       |
++-----------+
+
+
\ No newline at end of file