IniziaInizia gratis

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.

Questo esercizio fa parte del corso

Data-Driven Decision Making in SQL

Visualizza il corso

Istruzioni dell'esercizio

  • 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.

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

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
Modifica ed esegui il codice