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

· Q4 [1 pt]: Write the following queries based on the following schema: Movies(t

ID: 3592402 • Letter: #

Question

· Q4 [1 pt]: Write the following queries based on the following schema: Movies(title, year, length, genre, studioName, producerC4) StarsIn(movieTitle, movieYear, starName) MovieStar(name, address, gender, birthdate) MovieExec(name, address, cert#, networth) Studio name, address, presC#) Write the following queries in SQL: a) Who were the male stars in Titanic? b) Which stars appeared in movies produced by MGM in 1995? c) Who is the president of MGM studio? d) Which movies are longer than "Gone With the Wind"?

Explanation / Answer

(a) SELECT ms.name

FROM MovieStar ms INNER JOIN StarsIn s ON ms.name = s.starName

WHERE s.movieTitle = 'Titanic' AND ms.gender = 'male'

(b) SELECT s.starName

FROM StarsIn s INNER JOIN Movies m ON s.movieTitle = m.title

WHERE s.movieYear = '1995' AND m.studioName = 'MGM'

(c) SELECT presC# FROM Studio

WHERE name = 'MGM'

(d) SELECT m.title FROM Movies m

WHERE m.length > (SELECT length FROM Movies where title = 'Gone With the Wind')