开始使用免费开始使用

每位客户的平均评分

与刚才类似,这次请查看客户层面的电影平均评分。 也就是说,生成一张表,包含每位客户给出的平均评分。此外,还要包含每位客户的评分次数和租片次数。仅报告租片次数超过 7 次的客户的这些汇总统计量,并按平均评分升序排列。

本练习是课程的一部分

用 SQL 进行数据驱动决策

查看课程

练习说明

  • customer_idrenting 表分组,并输出 customer_id、平均评分、评分次数和租片次数。
  • 仅选择租片次数超过 7 次的客户。
  • 将结果表按平均评分升序排序。

交互式实操练习

通过完成这段示例代码来试试这个练习。

SELECT ___, -- Report the customer_id
      ___,  -- Report the average rating per customer
      ___,  -- Report the number of ratings per customer
      ___  -- Report the number of movie rentals per customer
FROM renting
GROUP BY customer_id
___ -- Select only customers with more than 7 movie rentals
ORDER BY ___; -- Order by the average rating in ascending order
编辑并运行代码