Question: SQL ( 2 5 marks ) Answer the questions based on the following database which contains information about actors, movies and roles performed: Actor (
SQL marks
Answer the questions based on the following database which contains information about actors, movies and roles performed:
Actor actorid name, yearborn
Movie movieid title, author, yearshow
Role actorid charactername, movieid
Where:
Actor is a table of actors, their names, and the year they were born. Each actor has a unique actorid which is a key.
Movie is a table of movies, giving the title, author name, and the year of shows for each movie. Each movie has a unique movieid which is a key.
Role records which actors have performed which roles characters in which movie. Attributes actorid and movieid are foreign keys to Actor and Movie respectively. All three attributes make up the key since it is possible for a single actor to play more than one character in the same movie.
a Write the SQL statements that define create the relational schema tables for this database. Assume that actorid movieid yearborn and yearwritten are all integers, and that name, title, author, and charactername are strings. Be sure to define appropriate keys and foreign key constraints. marks
b Show the relationship of the above tables in ER diagram using Crows Foot model. marks
c What does it meant by referential integrity? Show how this integrity can be achieved through the example of tables as the above. marks
d Write an SQL statement to find the name of the actor who born in year marks
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
