题解 | #返回产品名称和每一项产品的总订单数#
返回产品名称和每一项产品的总订单数
http://www.nowcoder.com/practice/1c64fd9048364a58a8ffa541720359a4
SELECT prod_name, COUNT(order_num) AS orders
FROM Products p
LEFT JOIN OrderItems ot ON p.prod_id = ot.prod_id
GROUP BY prod_name
ORDER BY prod_name