12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
-
- INSERT INTO movies (title, runtime, genre, imdb_score, rating)
- VALUES('Howard the Duck', '110', 'Sci-Fi', '4.6', 'PG'),
- ('Lavalantula', '83', 'Horror', '4.7', 'TV-14'),
- ('Starship Troopers', '129', 'Sci-Fi', '7.2', 'PG-13'),
- ('Waltz With Bashir', '90', 'Documentary', '8.0', 'R'),
- ('Spaceballs', '96', 'Comedy', '7.1', 'PG'),
- ('Monsters Inc.', '92', 'Animation', '8.1', 'G'),
- ('The Shawshank Redemption', '142', 'Drama', '9.3', 'R'),
- ('The Godfather', '175', 'Drama', '9.2', 'R');
-
-
-
- SELECT *
- FROM movies
- WHERE genre = 'Sci-Fi';
-
-
-
- SELECT *
- FROM movies
- WHERE imdb_score >= '6.5';
-
-
-
- SELECT title, rating, runtime
- FROM movies
- WHERE rating = 'G' OR rating = 'PG' AND runtime < '100';
-
-
-
- SELECT AVG(runtime), genre
- FROM movies
- WHERE imdb_score < '7.5'
- GROUP BY genre;
-
-
-
- UPDATE movies
- SET rating = 'R'
- WHERE title = 'Starship Troopers';
-
-
-
- SELECT id, title, rating, genre
- FROM movies
- WHERE genre = 'Horror' OR genre = 'Documentary';
-
-
-
- SELECT AVG(imdb_score), MAX(imdb_score), MIN(imdb_score), rating
- FROM movies
- GROUP BY rating;
-
-
-
-
- SELECT AVG(imdb_score), MAX(imdb_score), MIN(imdb_score), rating
- FROM movies
- GROUP BY rating HAVING COUNT(*)>1;
-
-
-
-
- DELETE FROM movies
- WHERE rating = 'R';
-
-
-
|