From d74f50ebbf46b6e06ba76f5e73f77d2ba1f220f2 Mon Sep 17 00:00:00 2001 From: haibarawu Date: Thu, 4 Jun 2020 12:54:29 -0700 Subject: [PATCH] Update and rename 0183. Customers Who Never Order.sql to 0183.(Easy) Customers Who Never Order.sql --- ...=> 0183.(Easy) Customers Who Never Order.sql} | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) rename Database/{0183. Customers Who Never Order.sql => 0183.(Easy) Customers Who Never Order.sql} (57%) diff --git a/Database/0183. Customers Who Never Order.sql b/Database/0183.(Easy) Customers Who Never Order.sql similarity index 57% rename from Database/0183. Customers Who Never Order.sql rename to Database/0183.(Easy) Customers Who Never Order.sql index 77c3a2f..514e2d9 100644 --- a/Database/0183. Customers Who Never Order.sql +++ b/Database/0183.(Easy) Customers Who Never Order.sql @@ -1,10 +1,24 @@ /**************************************** 183. Customers Who Never Order +183. 从不订购的客户 Difficulty: Easy Suppose that a website contains two tables, the Customers table and the Orders table. Write a SQL query to find all customers who never order anything. +某网站包含两个表,Customers 表和 Orders 表。编写一个 SQL 查询,找出所有从不订购任何东西的客户。 + +SQL Schema: +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') Table: Customers. +----+-------+ @@ -25,6 +39,7 @@ Table: Orders. +----+------------+ Using the above tables as example, return the following: +例如给定上述表格,你的查询应返回: +-----------+ | Customers | +-----------+ @@ -50,3 +65,4 @@ WHERE Customers.Id NOT IN ( FROM Orders ) +