欢迎光临散文网 会员登陆 & 注册

inner join & outer join 专题

2022-09-13 11:29 作者:限量版范儿  | 我要投稿

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

inner join & outer join 专题的评论 (共 条)

分享到微博请遵守国家法律