Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Return all of the unique years in the movie table */
- SELECT * FROM movies
- ORDER BY YEAR ASC;
- /* Return all of the unique years in the movies table sorted from oldest to newest. */
- SELECT * FROM movies
- WHERE genre = 'drama';
- /* Return all movies that are dramas. */
- SELECT * FROM movies
- WHERE name LIKE '%bride%';
- /* retunere kun film fra year 2000 til 2015, de bliver s sorteret i descending order. */
- SELECT * FROM movies
- WHERE YEAR
- BETWEEN 2000 AND 2015
- ORDER BY YEAR DESC;
- /*retunere movies som er udgivet i 1995 eller har en imdb rating p 9.0 */
- SELECT * FROM movies
- WHERE YEAR = 1995
- OR
- imdb_rating = 9;
- /* retunere MAX 3 movies fra movies hvor at rating = 3 */
- SELECT * FROM movies
- WHERE imdb_rating = 7
- LIMIT 3;
- /*retunere movies hvor at rating er > 6
- hvor at genre er comedy, er lavet efter year 1995
- Der retuneres max 10 */
- SELECT * FROM movies
- WHERE imdb_rating > 6
- AND
- genre = 'comedy'
- AND
- YEAR > 1995
- ORDER BY imdb_rating DESC
- LIMIT 10;
- /* retunere alle film som har prcis navnet "Cast Away" */
- SELECT * FROM movies
- WHERE name = 'Cast Away';
- /* retunere alle film som IKKE har rating 7 */
- SELECT * FROM movies
- WHERE imdb_rating != 7;
- /* Retunere alle horror movies med en drligere rating end 6 */
- SELECT * FROM movies
- WHERE genre = 'horror'
- AND
- imdb_rating < 6;
- /*retunere 10 movies hvor rating er 8 og sorteret med genre */
- SELECT * FROM movies
- WHERE imdb_rating = 8
- ORDER BY genre ASC
- LIMIT 10;
- /* retunere alle mobies hvor "king" er indeholdt */
- SELECT * FROM movies
- WHERE name LIKE '%King%';
- /* retunere alle movies hvor at Out er det sidste ord. */
- SELECT * FROM movies
- WHERE name LIKE '%Out';
- /*Return all the movies with name that begin with the word "The" sorted by imdb rating from highest to lowest */
- SELECT * FROM movies
- WHERE name LIKE 'The%'
- ORDER BY imdb_rating DESC;
- /* Return all of the movies */
- SELECT * FROM movies;
- /* Return the name and id of each movie with an id greater than 125 */
- SELECT DISTINCT name FROM movies
- WHERE id > 125;
- /*Return all movies names that begin with 'X-Men' */
- SELECT * FROM movies
- WHERE name LIKE'X-Men%';
- /*Return the first 10 movies sorted in reverse alphabetical order */
- SELECT * FROM movies
- WHERE id < 11
- ORDER BY name DESC;
- /*Return the id, name and genre of all movies that are romances */
- SELECT DISTINCT id, name, genre FROM movies
- WHERE genre = 'romance';
- /*Return all of the Twilight movies in order from the year they were released from oldest to newest */
- SELECT * FROM movies
- WHERE name LIKE '%Twilight%'
- ORDER BY YEAR ASC;
- /*Return all of the movies that were released in 2012 that are comedies */
- SELECT * FROM movies
- WHERE YEAR = 2012
- AND
- genre = 'comedy';
Advertisement
Add Comment
Please, Sign In to add comment