Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Add foreign key constraints 2. Description 2.1 Tables with Primary Keys The primary key for each table is underlined. Movies(movieID, name, year, rating, length, totalEarned)
Add foreign key constraints
2. Description 2.1 Tables with Primary Keys The primary key for each table is underlined. Movies(movieID, name, year, rating, length, totalEarned) Theaters(theaterID, address, numSeats) TheaterSeats(theater D, seatNum, brokenSeat) Showings(theaterID, showingDate, startTime, movielD, priceCode) Customers(customerID, name, address, joinDate, status) Tickets(theaterID, seatNum, showingDate, startTime, customerID, ticketPrice) ModifyShowings(theaterID, showingDate, startTime, movieID) 2.3 Add Foreign Key Constraints Here's a description of the Foreign Keys that you need to add. (Foreign Key Constraints are also referred to as Referential Integrity constraints.) Just add the constraints listed below in the form listed, even if you think that different Referential Integrity constraints should exist. Note that (for example) when we say that a showing in the Tickets table must appear in the Showings table, that says that the Tickets table has a Foreign Key referring to the Primary Key of the Showings table. Each showing in the Tickets table must appear in the Showings table. (Explanation of what that means appear in the above paragraph.) If a Showings tuple is deleted and there are tickets for that showing, the deletion should be rejected. Also, if the Primary Key of a Showings tuple is updated, and there are tickets for that showing, then the update should be rejected. Each customer that's in the Tickets table must appear in the Customers table. If a tuple in the Customers table is deleted, then all tickets for the corresponding customerID should be have their customerID set to NULL. If customerID for a tuple in the Customers table is updated, then all Tickets tuples for that customerID should be updated the same way. Each theater seat in the Tickets table must appear in the TheaterSeats table. [A theater seat is identified by the Primary Key of the TheaterSeats table, (theaterID, seatNum).] If a tuple in the then all tickets for that theater seat should also be deleted. If the Primary Key of a theater seat in TheaterSeats is updated, then all Tickets for that theater seat in Tickets should be updated the same way Write commands to add foreign key constraints in the same order that the foreign keys are described above. Save your commands to the file foreign.sql
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started