Get startedGet started for free

Average rating per customer

Similar to what you just did, you will now look at the average movie ratings, this time for customers. So you will obtain a table with the average rating given by each customer. Further, you will include the number of ratings and the number of movie rentals per customer. You will report these summary statistics only for customers with more than 7 movie rentals and order them in ascending order by the average rating.

This exercise is part of the course

Data-Driven Decision Making in SQL

View Course

Exercise instructions

  • Group the data in the table renting by customer_id and report the customer_id, the average rating, the number of ratings and the number of movie rentals.
  • Select only customers with more than 7 movie rentals.
  • Order the resulting table by the average rating in ascending order.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

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
Edit and Run Code