假设一个网站包含两个表,Customers表和Orders表。编写SQL查询以查找所有没订购任何商品的客户。
![](https://i-blog.csdnimg.cn/blog_migrate/cad7c3774219e863d65f65ebe1087bc8.png)
![](https://i-blog.csdnimg.cn/blog_migrate/88782148b9010af0f1a1315b78a2fe77.png)
![](https://i-blog.csdnimg.cn/blog_migrate/652fc82ec9bfe942a00ff6e2ad9c6f28.png)
用到left outer join:
select c.name Customers from customers c
left outer join orders o on c.id=o.customerid
where customerid is null
假设一个网站包含两个表,Customers表和Orders表。编写SQL查询以查找所有没订购任何商品的客户。
用到left outer join:
select c.name Customers from customers c
left outer join orders o on c.id=o.customerid
where customerid is null