在第二章我们也学了in运算符,这次更深入些
第二章,5-IN运算符(the In operator)--Mosh mySQL_小猪快跑,不要摔倒的博客-CSDN博客
1,查询没有被预定过的产品
需要把orders和products两表结合
select *
from products
where product_id not in
(select distinct product_id
from order_items)
2,练习
答案:
select *
from clients
where client_id not in
(select distinct client_id
from invoices)