-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathscript.sql
More file actions
23 lines (18 loc) · 1.67 KB
/
script.sql
File metadata and controls
23 lines (18 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
INSERT INTO Movies (TITLE, RUNTIME, GENRE, IMDB_SCORE, RATING) VALUES ('Howard the Duck', 110, 'Sci-Fi', 4.6, 'PG');
INSERT INTO Movies (TITLE, RUNTIME, GENRE, IMDB_SCORE, RATING) VALUES ('Lavalantula', 83, 'Horror', 4.7, 'TV-14');
INSERT INTO Movies (TITLE, RUNTIME, GENRE, IMDB_SCORE, RATING) VALUES ('Starship Troopers', 129, 'Sci-Fi', 7.2, 'PG-13');
INSERT INTO Movies (TITLE, RUNTIME, GENRE, IMDB_SCORE, RATING) VALUES ('Waltz With Bashir', 90, 'Documentary', 8.0, 'R');
INSERT INTO Movies (TITLE, RUNTIME, GENRE, IMDB_SCORE, RATING) VALUES ('Spaceballs', 96, 'Comedy', 7.1, 'PG');
INSERT INTO Movies (TITLE, RUNTIME, GENRE, IMDB_SCORE, RATING) VALUES ('Monsters Inc.', 92, 'Animation', 8.1 'G');
INSERT INTO Movies (TITLE, RUNTIME, GENRE, IMDB_SCORE, RATING) VALUES ('Ready Player One', 120, 'Animation', 8.4, 'PG-13');
INSERT INTO Movies (TITLE, RUNTIME, GENRE, IMDB_SCORE, RATING) VALUES ('A Quiet Place', 105, 'Horror', 8.2, 'PG-13');
INSERT INTO Movies (TITLE, RUNTIME, GENRE, IMDB_SCORE, RATING) VALUES ('Isle of Dogs', 95, 'Animation', 9.0, 'G');
SELECT * FROM Movies WHERE GENRE = 'Sci-Fi';
SELECT * FROM Movies WHERE IMDB_SCORE > 6.4;
SELECT * FROM Movies WHERE RATING = 'G' AND RUNTIME < 100 OR RATING = 'PG' AND RUNTIME < 100;
SELECT AVG(RUNTIME) FROM Movies WHERE IMDB_SCORE < 7.5 GROUP BY GENRE;
UPDATE Movies SET Rating = 'R' WHERE Title = 'Starship Troopers';
SELECT ID, Rating FROM Movies WHERE Genre = 'Horror' OR Genre = 'Documentary'
SELECT Rating, AVG(IMDB_Score), MIN(IMDB_SCORE), MAX(IMDB_SCORE) FROM Movies GROUP BY Rating;
SELECT Rating, AVG(IMDB_Score), MIN(IMDB_SCORE), MAX(IMDB_SCORE) FROM Movies GROUP BY Rating HAVING COUNT(RATING) > 1;
DELETE FROM Movies WHERE Rating = 'R';