Movie (MovieID, Title, Year, Score, Votes) Actor(ActorID, Name) Casting (MovieID
ID: 3881113 • Letter: M
Question
Movie (MovieID, Title, Year, Score, Votes)
Actor(ActorID, Name)
Casting (MovieID, ActorID, Ordinal)
You need to create a le called constraints.sql, which is a text le containing
your constraints for each of the questions given below.
1. (10 points) The default actor name is `Adam Sandler'.
2. (10 points) The score for a movie must be a value between 0 and 10.
3. (10 points) After you successfully set up the score constraint, first you then disable the constraint; second you enable the constraint.
Explanation / Answer
1) ALTER TABLE Actor
ALTER COLUMN Name SET DEFAULT 'Adam Sandler';
2) ALTER TABLE Movie ADD CONSTRAINT check_score CHECK (Score BETWEEN 0 and 10);
3) Statement to disable constraint 2
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.