Leetcode : Customers Who Never Order

Now we’ve got two table. One customer table for customerid and their names, One Order tablefor customers’ Id that bought something.
We will find the customers that in the customer table but not in order table.

Method

Use NOT IN.

select Name from Customers
where Id not in
(select CustomerId from Orders order by CustomerId);
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章