Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help with the syntax And also what key am I suppose to use? unique? primary? foreign? pls explain..this is my syntax create table
I need help with the syntax And also what key am I suppose to use? unique? primary? foreign? pls explain..this is my syntax
create table Movie(mID int unique, title VARCHAR(200), year int, director VARCHAR(200), Primary Key(title,year)); create table Reviewer(rID int unique, name VARCHAR(200) NOT NULL); create table Rating(rID int , mID int , stars int NOT NULL , ratingDate date );
Schema: Movie (mID, title, year, director) English: There is a movie with ID number mie, a title, a release year, and a director Reviewer (R, name) English: The reviewer with ID number dR has a certain name. Rating LrD mID, stars, ratingDate) English: The reviewer R gave the movie mlD a.number.of stars rating (1-5) on a certain ratingRate. Unlike most of our other exercises, which are a set of queries to be written individually, this exercise set involves bigger chunks of work followed by a series of tests. If the constraints are implemented correctly, the tests will generate or not generate errors as specified. To verify that the referential integrity policies are implemented correctly, there is a check of the final database state. Task 1: Constraint Declarations Modify the three CREATE TABLE statements in the ratingJlab.sal to add the following constraints. Your three resulting CREATE TABLE statements should meet both the Key constraints and Non-Null constraints Key Constraints 1. mD is a key for Movie and (titleyeac) is another key for Movie 2. uD is a key for Reviewer 3. (R.mUR.tatingDate) is a key for Rating but with null values allowed Non-Null Constraints 4. Reviewer.name may not be NULL 5. Rating.stars, may not be NULLStep 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