KnowledgeBoat Logo
|

Computer Science

In a multiplex, movies are screened in different auditoriums. One movie can be shown in more than one auditorium. In order to maintain the record of movies, the multiplex maintains a relational database consisting of two relations viz. MOVIE and AUDI respectively as shown below :

Movie(Movie_ID, MovieName, ReleaseDate)
Audi(AudiNo, Movie_ID, Seats, ScreenType, TicketPrice)

(a) Is it correct to assign Movie_ID as the primary key in the MOVIE relation ? If no, then suggest an appropriate primary key.

(b) Is it correct to assign AudiNo as the primary key in the AUDI relation ? If no, then suggest appropriate primary key.

(c) Is there any foreign key in any of these relations ?

Relational Database

2 Likes

Answer

(a) Yes, assigning MovieID as the primary key in the MOVIE relation is correct because each movie has a unique MovieID.

(b) It is not correct to assign AudiNo as the primary key in the AUDI relation because an AudiNo can be repeated for different movies screened in different auditoriums. To uniquely identify each record in the AUDI relation, a composite primary key consisting of AudiNo and Movie_ID should be used.

(c) Yes, there is a foreign key in the AUDI relation. The MovieID attribute in the AUDI relation is a foreign key that references the MovieID primary key in the MOVIE relation.

Answered By

1 Like


Related Questions