Question: Write Unit Tests in SQL 2. Description 2.1 Tables with Primary Keys The primary key for each table is underlined. Movies(movieID, name, year, rating, length,
Write Unit Tests in SQL


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.5 Write unit tests Unit tests are important for verifying that your constraints are working as you expect. We will require tests for just a few common cases, but there are many more unit tests that are possible. For each of the 3 foreign key constraints specified in section 2.3, write one unit test: 0 An INSERT command that violates the foreign key constraint (and elicits an error). Also, for each of the 3 general constraints, write 2 unit tests: 0 An UPDATE command that meets the constraint. O An UPDATE command that violates the constraint (and elicits an error). Save these 3 + 6 = 9 unit tests, in the order given above, in the file unittests.sql. 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.5 Write unit tests Unit tests are important for verifying that your constraints are working as you expect. We will require tests for just a few common cases, but there are many more unit tests that are possible. For each of the 3 foreign key constraints specified in section 2.3, write one unit test: 0 An INSERT command that violates the foreign key constraint (and elicits an error). Also, for each of the 3 general constraints, write 2 unit tests: 0 An UPDATE command that meets the constraint. O An UPDATE command that violates the constraint (and elicits an error). Save these 3 + 6 = 9 unit tests, in the order given above, in the file unittests.sql
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
