183. 从不订购的客户

# 498ms
select c.Name as Customers from Customers c left join Orders o on o.CustomerId = c.Id where o.Id is null;

# 532ms
select c.Name as Customers from Customers c where not exists (select 1 from Orders o where o.CustomerId = c.Id);

# 455ms
select c.Name as Customers from Customers c where c.Id not in (select distinct o.CustomerId from Orders o);

 

posted @ 2020-12-23 11:30  巴黎爱工作  阅读(106)  评论(0编辑  收藏  举报