/*
	Solutions to the Star Wars SQL query problems
	on the "More examples" slide (slide 12).
	CSE 444, fall 2010
	Section 1, September 30, 2010
 */

-- Names of all Star Wars movies
SELECT name
FROM Movie
WHERE name LIKE '%Star Wars%'
;
-- attribute LIKE 'pattern' is similar to 
-- attribute = 'pattern', except that instead
-- of matching themselves, '%' in the pattern
-- matches any number of characters, and '_'
-- matches one character.

-- All Star Wars movies made in 2000 or later
SELECT *
FROM Movie
WHERE name LIKE '%Star Wars%' AND
	year >= 2000
;

-- Names and production years of all Star Wars movies
-- from earliest to latest
SELECT name, year
FROM Movie
WHERE name LIKE '%Star Wars%' AND
	year IS NOT NULL
ORDER BY year
;
-- Some movies have their year listed as NULL,
-- meaning that the production year was not stored
-- in the original IMDB data import.  
-- year IS NOT NULL causes such movies to be included.
