Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedimage text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

More Books

Students also viewed these Databases questions

Question

f. Did they change their names? For what reasons?

Answered: 1 week ago