SQL ile Veri Odaklı Karar Verme
Bart Baesens
Professor Data Science and Analytics
Ülkeye veya cinsiyete göre müşteri tercihleri.
Türe veya çıkış yılına göre filmlerin popülerliği.
Türe göre filmlerin ortalama fiyatı.
SELECT genre
FROM movies_selected
GROUP BY genre;
| genre |
|-------------|
| Drama |
| Fantasy |
| Sci-Fiction |
| Animation |
| Romance |
SELECT genre,
AVG(renting_price) AS avg_price
FROM movies_selected
GROUP BY genre;
| genre | avg_price |
|-------------|-------------|
| Drama | 2.865 |
| Fantasy | 2.69 |
| Sci-Fiction | 2.87 |
| Animation | 2.923333333 |
| Romance | 2.99 |
SELECT genre,
AVG(renting_price) AS avg_price,
COUNT(*) AS number_movies
FROM movies_selected
GROUP BY genre
| genre | avg_price | number_movies |
|-------------|---------------|---------------|
| Drama | 2.865 | 4 |
| Fantasy | 2.69 | 3 |
| Sci-Fiction | 2.87 | 2 |
| Animation | 2.923333333 | 3 |
| Romance | 2.99 | 1 |
SELECT genre,
AVG(renting_price) avg_price,
COUNT(*) number_movies
FROM movies
GROUP BY genre
HAVING COUNT(*) > 2;
| genre | avg_price | number_movies |
|-----------|---------------|---------------|
| Drama | 2.865 | 4 |
| Fantasy | 2.69 | 3 |
| Animation | 2.923333333 | 3 |
SQL ile Veri Odaklı Karar Verme