Nick Satinover 5 vuotta sitten
vanhempi
commit
247294c7f7
1 muutettua tiedostoa jossa 14 lisäystä ja 1 poistoa
  1. 14
    1
      src/main/resources/script.sql

+ 14
- 1
src/main/resources/script.sql Näytä tiedosto

@@ -15,4 +15,17 @@ SELECT * FROM MOVIES WHERE GENRE='Sci-Fi';
15 15
 SELECT * FROM MOVIES WHERE IMDB_SCORE >= 6.5;
16 16
 
17 17
 SELECT * FROM MOVIES WHERE
18
-RUNTIME < 100 AND RATING = 'G' OR RATING = 'PG';
18
+RUNTIME < 100 AND RATING = 'G' OR RATING = 'PG';
19
+
20
+SELECT GENRE, AVG(RUNTIME)
21
+FROM MOVIES WHERE IMDB_SCORE < 7.5 GROUP BY GENRE;
22
+
23
+UPDATE MOVIES SET RATING = 'R' WHERE TITLE = 'Starship Troopers';
24
+
25
+SELECT TITLE, ID, RATING FROM MOVIES WHERE GENRE = 'Horror' OR GENRE = 'Documentary';
26
+
27
+SELECT RATING, AVG(IMDB_SCORE), MIN(IMDB_SCORE), MAX(IMDB_SCORE) FROM MOVIES GROUP BY RATING ;
28
+
29
+SELECT RATING, AVG(IMDB_SCORE), MIN(IMDB_SCORE), MAX(IMDB_SCORE) FROM MOVIES GROUP BY RATING HAVING COUNT(*) > 1;
30
+
31
+DELETE FROM MOVIES WHERE RATING = 'R';