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

Using this Movies database schema : Movies(title,year,length,genre,studioName,pr

ID: 653680 • Letter: U

Question

Using this Movies database schema :

Movies(title,year,length,genre,studioName,producerC#)
StarsIn(movieTitle,movieYear,starName)
MovieStar(name,address,gender,birthDate)
MovieExec(name,address,certC#,netWorth)
Studio(name,address,presC#)

write the SQL for each of the following queries:

a) Who were the male stars in Titanic?

b) which stars appeared i MGM movies during 1995?

c) Who is president of MGM studios?

d) Which movies are longer than Gone With the Wind?

e) Which studios produced movies in 1980 with stars born in 1940?

Explanation / Answer

a) Who were the male stars in Titanic?

Answer:

SQL> select StarsIn.starName,Movies.title from Movies, StarsIn where Movies.title=StarsIn.movieTitle and Movies.genre='male' and Movies.title='Titanic';

b) which stars appeared in MGM movies during 1995?
Answer:
SQL> select StarsIn.starName,Movies.studioName from Movies,StarsIn where movieYear=1995 and Movies.studioName='MGM' and StarsIn.movieTitle=Movies.title;

c) Who is president of MGM studios?
Answer:

SQL> select Studio.name,Movies.studioName from Studio,Movies where ProducerC#=presC#;

d) Which movies are longer than Gone With the Wind?
Answer:

SQL> select Movies.title,StarsIn.movieYear from Movies,StarsIn where Movies.title='Gone With the Wind' and StarsIn.movieYear>Movies.year and Movies.title=StarsIn.movieTitle;

e) Which studios produced movies in 1980 with stars born in 1940?
Answer:

SQL> select Studio.*,StarsIn.starName from Studio,StarsIn,Movies where Movies.year=1980 and format(MovieStar.birthDate,'yyyy')='1940';