MulaiMulai sekarang secara 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.

Latihan ini adalah bagian dari kursus

Data-Driven Decision Making in SQL

Lihat Kursus

Petunjuk latihan

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

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

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 dan Jalankan Kode