183. Customers Who Never Order

原题链接:https://leetcode.com/problems/customers-who-never-order/description/
做完这道题目我才发现,我跟不就不懂 in, exists, not in, not exists,exists 用都不会用:

# Write your MySQL query statement below
select Name as Customers from Customers where not exists (select CustomerId from Orders where Customers.Id = Orders.CustomerId);

select Name as Customers from Customers where 
Id not in (select CustomerId from Orders);
posted @ 2018-03-22 12:34  optor  阅读(125)  评论(0编辑  收藏  举报