183. 从不订购的客户

文章访问量:

LEFT JOIN

https://leetcode.cn/problems/customers-who-never-order/description/

五一节后,写道简单水题爽一爽。

SQL
# Write your MySQL query statement below
SELECT A.name AS 'Customers'
FROM Customers AS A 
LEFT JOIN Orders AS B 
ON A.id = B.customerId
WHERE B.customerId is NULL

一开始想用NOT EXISTS去做,但想了想开销应该要比联结大一些,而且还麻烦。

Subscribe
提醒
0 评论
Inline Feedbacks
View all comments
0
在此留下你的评论x