Question
I need to modify my CREATE TABLE statements to get proper error message from the following statements I have my create table statements below. I
I need to modify my CREATE TABLE statements to get proper error message from the following statements I have my create table statements below. I just need help with 14 to give me an error message for my database driven website class. I have attached the full sql code below as well.
/* Delete the tables if they already exist */ drop table if exists Movie; drop table if exists Reviewer; drop table if exists Rating;
/* Create the schema for our tables */ create table Movie(mID int PRIMARY KEY, title VARCHAR(200), year int UNIQUE, director VARCHAR(200)); create table Reviewer(rID int PRIMARY, name VARCHAR(200) NOT NULL); create table Rating(rID int NOT NULL, mID int NOT NULL, stars int NOT NULL, ratingDate date NULL);
/* Populate the tables with our data */ insert into Movie values(101, 'Gone with the Wind', 1939, 'Victor Fleming'); insert into Movie values(102, 'Star Wars', 1977, 'George Lucas'); insert into Movie values(103, 'The Sound of Music', 1965, 'Robert Wise'); insert into Movie values(104, 'E.T.', 1982, 'Steven Spielberg'); insert into Movie values(105, 'Titanic', 1997, 'James Cameron'); insert into Movie values(106, 'Snow White', 1937, null); insert into Movie values(107, 'Avatar', 2009, 'James Cameron'); insert into Movie values(108, 'Raiders of the Lost Ark', 1981, 'Steven Spielberg');
insert into Reviewer values(201, 'Sarah Martinez'); insert into Reviewer values(202, 'Daniel Lewis'); insert into Reviewer values(203, 'Brittany Harris'); insert into Reviewer values(204, 'Mike Anderson'); insert into Reviewer values(205, 'Chris Jackson'); insert into Reviewer values(206, 'Elizabeth Thomas'); insert into Reviewer values(207, 'James Cameron'); insert into Reviewer values(208, 'Ashley White');
insert into Rating values(201, 101, 2, '2011-01-22'); insert into Rating values(201, 101, 4, '2011-01-27'); insert into Rating values(202, 106, 4, null); insert into Rating values(203, 103, 2, '2011-01-20'); insert into Rating values(203, 108, 4, '2011-01-12'); insert into Rating values(203, 108, 2, '2011-01-30'); insert into Rating values(204, 101, 3, '2011-01-09'); insert into Rating values(205, 103, 3, '2011-01-27'); insert into Rating values(205, 104, 2, '2011-01-22'); insert into Rating values(205, 108, 4, null); insert into Rating values(206, 107, 3, '2011-01-15'); insert into Rating values(206, 106, 5, '2011-01-19'); insert into Rating values(207, 107, 5, '2011-01-20'); insert into Rating values(208, 104, 3, '2011-01-02');
11. update Movie set mID = mID + 1;
12. insert into Movie values (109, 'Titanic', 1997, 'JC');
13. insert into Reviewer values (201, 'Ted Codd');
14. update Rating set rID = 205, mID = 104;
15. insert into Reviewer values (209, null);
Step by Step Solution
There are 3 Steps involved in it
Step: 1
To modify your SQL statements to return a proper error message for statement 14 well need to ensure that we are aware of the constraints in your datab...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