之前有一题说要用outter join
其实left和right join都属于outer join
且根据题目的描述,这里并不适合使用全连接(使用左连接,结果如下)
select Vendors.vend_id as vend_id, count(Products.prod_id) as prod_id
from Vendors
left join Products
on Vendors.vend_id = Products.vend_id
group by Vendors.vend_id
order by Vendors.vend_id