46.Merchant - 识别评分较低的产品
为了保持各种各样的产品,反映客户需求和库存生产力,dimestore使用产品评论获得低评级产品的列表删除。
玛丽,一个category经理,要求朱迪弄出一个平评分小于1的产品列表。
运行该查询,找出哪些产品的平均评级低于1。
SELECT product.name, product.productId, ROUND(AVG(reviews.rating), 3) avgRating, COUNT(reviews) numReviews
FROM product JOIN reviews ON KEYS product.reviewList
GROUP BY product HAVING AVG(reviews.rating) < 1
结果:
{
"results": [
{
"avgRating": 0.75,
"name": "Britax B-Agile Stroller Child Tray",
"numReviews": 4,
"productId": "product83"
},
{
"avgRating": 0.667,
"name": "New Commercial Stainless Steel Salt / Pepper / Spice / Sugar Shaker, Shakers, Dredge, Dredges, Set of 2",
"numReviews": 6,
"productId": "product96"
},
{
"avgRating": 0.5,
"name": "Danze D481150 9-Inch Adjustable Shower Arm with High Flow, Chrome",
"numReviews": 6,
"productId": "product476"
},
{
"avgRating": 0.889,
"name": "Briggs & Riley Luggage Executive Clamshell Backpack",
"numReviews": 9,
"productId": "product10"
},
{
"avgRating": 0.889,
"name": "Tovolo Sphere Ice Molds, Set of 2",
"numReviews": 9,
"productId": "product53"
}
]
}
Last updated
Was this helpful?