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

You have three tables in your relational database: Movie , Star , and RolePlayed

ID: 3821863 • Letter: Y

Question

You have three tables in your relational database: Movie, Star, and RolePlayed.

If the goal is to retrieve the title and rating of each movie in which “Meg Ryan” played a role, what errors, if any, exist in the following SQL statement?

SELECT *

FROM RolePlayed

         WHERE StarID=”Meg Ryan”;

Answer:

(1) Movie (2) Star Rating Stari Name Movie Title Year Birth M1 PG-13 St1 Tom Hanks 1956 Castaway St2 Meg Ran M2 You've Got Mail PG 1961 M3 City of Angels PG-13 ISt3 Nicolas Cage 1964 (3) RolePlayed MoyielD StarD characterName M1 St1 Chuck Noland St1 M2 Joe Fox M2 St2 Kathleen Kelly M3 St2 Maggie Rice IM3 S3 Seth

Explanation / Answer

You query is incorrect. starID is not taking name string and you want to extract title and rating only not all the attributs using select *.Morever the rating is in another table.You have to do the join operation to get the answer.

This is a generalize query(mysql syntax), syntax varies from vendor version of sql like oracle, sql and sql server.

SELECT m.Title,m.Rating

FROM Movie m,RolePlayed r,Star s

WHERE s.StarId=r.StarID AND s.Name="Meg Ryan" AND r.MovieID=m.MovieID

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote