Christian Sheridan преди 5 години
родител
ревизия
0f2eb481ca
променени са 1 файла, в които са добавени 21 реда и са изтрити 0 реда
  1. 21
    0
      src/main/resources/script.sql

+ 21
- 0
src/main/resources/script.sql Целия файл

@@ -0,0 +1,21 @@
1
+part 1
2
+INSERT INTO MOVIES ( TITLE, RUNTIME, GENRE, IMDB_SCORE, RATING ) VALUES ('Howard the Duck', '110', 'Sci-Fi', '4.6', 'PG');
3
+INSERT INTO MOVIES ( TITLE, RUNTIME, GENRE, IMDB_SCORE, RATING ) VALUES ('Lavalantula', '83', 'Horror', '4.7', 'TV-14');
4
+INSERT INTO MOVIES ( TITLE, RUNTIME, GENRE, IMDB_SCORE, RATING ) VALUES ('Starship Troopers', '129', 'Sci-Fi', '7.2', 'PG-13');
5
+INSERT INTO MOVIES ( TITLE, RUNTIME, GENRE, IMDB_SCORE, RATING ) VALUES ('Waltz with Bashir', '90', 'Documentary', '8.0', 'R');
6
+INSERT INTO MOVIES ( TITLE, RUNTIME, GENRE, IMDB_SCORE, RATING ) VALUES ('Spaceballs', '96', 'Comedy', '7.1', 'PG');
7
+INSERT INTO MOVIES ( TITLE, RUNTIME, GENRE, IMDB_SCORE, RATING ) VALUES ('Monsters Inc.', '92', 'Animation', '8.1', 'G');
8
+INSERT INTO MOVIES ( TITLE, RUNTIME, GENRE, IMDB_SCORE, RATING ) VALUES ('Forrest Gump', '142', 'Drama', '8.8', 'PG-13');
9
+INSERT INTO MOVIES ( TITLE, RUNTIME, GENRE, IMDB_SCORE, RATING ) VALUES ('Reservoir Dogs', '99', 'Drama', '8.3', 'R');
10
+INSERT INTO MOVIES ( TITLE, RUNTIME, GENRE, IMDB_SCORE, RATING ) VALUES ('Semi-Pro', '99', 'Comedy', '5.8', 'R');
11
+
12
+SELECT * FROM MOVIES WHERE GENRE='Sci-Fi';
13
+SELECT * FROM MOVIES WHERE IMDB_SCORE >='6.5';
14
+SELECT TITLE FROM MOVIES WHERE RATING = 'G' OR RATING = 'PG' AND RUNTIME < '100';
15
+SELECT GENRE, AVG(RUNTIME) FROM MOVIES WHERE IMDB_SCORE < '7.5' GROUP BY GENRE;
16
+UPDATE MOVIES SET RATING = 'R' WHERE TITLE = 'Starship Troopers';
17
+SELECT ID, RATING FROM MOVIES WHERE GENRE = 'Horror' OR GENRE = 'Documentary';
18
+SELECT RATING, AVG(IMDB_SCORE), MAX(IMDB_SCORE), MIN(IMDB_SCORE) FROM MOVIES GROUP BY RATING HAVING COUNT(*) > 1;
19
+DELETE FROM MOVIES WHERE RATING = 'R';
20
+
21
+