LeetCode 183. Customers Who Never Order
考点 | 难度 |
---|---|
Database | Easy |
题目
Write an SQL query to report all customers who never order anything.
Return the result table in any order.
思路
用not in
对customerid
进行筛选。
答案
select customers.name as 'Customers'
from customers
where customers.id not in (
select customerid from orders
);