Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 DBMS 中有以下三个表:
Customer(Id, Name, City), Product(Id, Name, Price), Orders(Cust_Id, Prod_Id, Date)
获取已订购所有产品的客户(如果有)的查询是什么?
select c.id from customer c inner join orders o on o.cust_id = c.id inner join product p on p.id = o.prod_id group by c.id having count(distinct p.id) = (select count(id) from product)