inner join & outer join 專題
1. inner join:
在店鋪表中找到含商品表中所有商品的店鋪:
select shopfrom items,shopitemswhere items.item = shopitems.itemgroup by shophaving count(*) = (select count(*) from items)
---針對集合設(shè)定條件:inner join 過濾出品類相同的記錄;having 條件為聚合后兩表品類數(shù)一致。
2. outer join:
在店鋪表中找到僅含商品表中所有商品的店鋪:
select shopfrom shopitems left join itemson shopitems.item = items.itemgroup by shophaving count(items.item) = (select count(*) from items)
---對 left join 匹配到的右列品類計數(shù),條件為與商品表品類數(shù)一致。?
?鏈接:https://www.dianjilingqu.com/530790.html
標(biāo)簽: