183.从不订购的客户
题目链接:https://leetcode-cn.com/problems/customers-who-never-order/
1. 题目
2. 解题过程
法一:
select
c.Name as Customers
from
Customers c left join Orders o
on c.Id=o.CustomerId
where
o.CustomerId is null;
法二:子查询
select
Customers.Name as Customers
from
Customers
where
Customers.Id not in (
select
c.Id
from
Customers c,
Orders o
where
c.Id=o.CustomerId
);
法三:
select
name as Customers
from
Customers
where
Id not in (select CustomerId from Orders);