inner join & outer join 专题
1. inner join:
在店铺表中找到含商品表中所有商品的店铺:
select shopfrom items,shopitemswhere items.item = shopitems.itemgroup by shophaving count(*) = (select count(*) from items)
---针对集合设定条件:inner join 过滤出品类相同的记录;having 条件为聚合后两表品类数一致。
2. outer join:
在店铺表中找到仅含商品表中所有商品的店铺:
select shopfrom shopitems left join itemson shopitems.item = items.itemgroup by shophaving count(items.item) = (select count(*) from items)
---对 left join 匹配到的右列品类计数,条件为与商品表品类数一致。
链接:https://www.dianjilingqu.com/530790.html