题解 | 分析不同门店各类商品的库存情况和销售情况
分析不同门店各类商品的库存情况和销售情况
https://www.nowcoder.com/practice/5b9262a36724466ea1ae1f58187197d6
-- 逻辑拆解:筛选条件是-库存量<10,销售额>5000。查询指标是商品类别、库存数量和销售额
SELECT
t2.store_id,
t3.store_name,
t1.product_category,
t2.inventory_quantity,
t2.sales_amount
FROM products t1
LEFT JOIN sales_inventory t2
ON t1.product_id = t2.product_id
LEFT JOIN stores t3
ON t2.store_id = t3.store_id
WHERE t2.inventory_quantity < 10
AND t2.sales_amount > 5000
ORDER BY t2.store_id,t1.product_id
查看21道真题和解析
华为HUAWEI工作强度 1372人发布