Database Questions Suppose that we have a logical schema representing movies, mo
ID: 3757081 • Letter: D
Question
Database Questions
Suppose that we have a logical schema representing movies, movie critics and their movie ratings. The relationship “ratings” captures which reviews were posted by which critics with the rating (0-100) and date. The logical schema is given below:
The logical schema is given below: Movie: (Title, Subtitle, Year, Duration, Edition) Ratings: (RevID, Title, Subtitle, Rating, RDate) Reviewer: ReviewerlD, Name, Address, Affiliation) Assume that the tables Movie and Reviewer have already been created with all of the necessary attributes, domains, and keys. Fill out the SQL table below to create the table Ratings with all of the necessary attributes, domains, and keys. Assume that Reviewer ID is an 8 characters string and that neither title nor sub-title needs more than 26 characters and that the rating nnot be NULL. You o Movie or Reviewer tables. CREATE TABLE CONSTRAINT UNIQUE_CONSTRAINT_PK1 PRIMARY KEY CONSTRAINT UNIQUE_CONSTRAINT_FK2 FOREIGN KEY ( REFERENCES CONSTRAINT UNIQUE_CONSTRAINT_FK3 FOREIGN KEY REFERENCESExplanation / Answer
POINTS :
PRIMARY KEY constraint uniquely identifies each record in a database table.
FOREIGN KEY is a key used to link two tables together.
NOT NULL constraint enforces a column to NOT accept NULL values.
CREATE TABLE Rating(
RevID VARCHAR2(8),
Title VARCHAR2(26),
Subtitle VARCHAR2(26),
Rating VARCHAR NOT NULL,
RDate date,
CONSTRAINT UNIQUE_CONSTRAINT_PK1 PRIMARY KEY (RevID),
CONSTRAINT UNIQUE_CONSTRAINT_FK2 FOREIGN KEY (Title) REFERENCES Movie(Title),
CONSTRAINT UNIQUE_CONSTRAINT_FK3 FOREIGN KEY (Subtitle) REFERENCES Movie(Subtitle)
);
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.