0% found this document useful (0 votes)
60 views1 page

SQL Basics and IMDB Queries Guide

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views1 page

SQL Basics and IMDB Queries Guide

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

/*key words for SQL Data definition language - CREATE, INSERT, UPDATE, DELETE,

DROP,TRUNCATE*/
/*key words in DML - SELECT, COUNT, DISTINCT, RANK, GROUP BY, ORDER BY, OFFSET,
LIMIT, WHERE, AS, IN, LIKE, NOT IN,TRUE,FALSE, WITH, CASE...*/
USE imdb3;
/* find the number of rows for each table in imdb schema*/
SELECT COUNT(*) AS total_number_of_rows_director_mapping FROM director_mapping;
SELECT COUNT(*) AS total_rows_genre FROM genre;
SELECT COUNT(*) AS total_rows_movie FROM movie;
SELECT COUNT(*) AS total_rows_names FROM names;
SELECT movie_id FROM director_mapping;
SELECT * FROM director_mapping;
SELECT * FROM genre;
SELECT * FROM genre g
WHERE g.genre = 'Thriller';
SELECT * FROM genre AS g
WHERE g.genre = 'Drama';

You might also like