Customers:
Id | Name |
---|---|
1 | Joe |
2 | Henry |
3 | Sam |
4 | Max |
Orders:
Id | CustomerId |
---|---|
1 | 3 |
2 | 1 |
Q:
- 根據Customers 和 Orders 表查找出從來沒有發生購買行爲的人
A:
select customers.name as "Customers"
from customers
where customers.id not in (
select customerid from orders
);