Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Consider Ullman and Widom’s movie database example: Movies (title, year, leng

ID: 3674824 • Letter: 1

Question

1. Consider Ullman and Widom’s movie database example: Movies (title, year, length, genre, studioName, producerC#) StarsIn (movieTitle, movieYear, starName) MovieStar (name, address, gender, birthdate) MovieExec (name, address, cert#, netWorth) Studio (name, address, presC#) Write SQL queries to answer the following questions:

a. List all the information in the Movies table in with name as the primary sort key and date as the secondary sort key. SELECT title FROM Movies WHERE

b. What year was Star Wars released?

c. List the name and gender for all stars who have appeared in comedies.

d. How many movies of each genre are there? List the genres and number in each.

e What movies were made by Paramount after 1990? List in order of ascending date.

Explanation / Answer

1. select * from Movies order by title, year

2. select title, year from Movies where title like 'Star Wars%'

3. select name, gender from MovieStar where name = StarsIn.starName and StarsIn.movieTitle = Movies.title and Movies.genre = 'comedies'

4. select genre, count(*) from Movies group by genre

5. select title, year, length, genre from Movies where studioName = 'Paramount' and year > 1990 order by year