题解 | #返回产品名称和每一项产品的总订单数#
返回产品名称和每一项产品的总订单数
https://www.nowcoder.com/practice/1c64fd9048364a58a8ffa541720359a4
mysql不支持外连接,左连接+右连接:
select prod_name, count(order_num)orders from Products
left join OrderItems using(prod_id)
group by prod_name
union
right join OrderItems using(prod_id)
group by prod_name
order by prod_name