CST 333 Database Systems Assignment 4 Solution

CST 333 Database Systems (Online)

Homework Assignment #4 (Max: 12 pts)

Exercise 1 (2 pts)

Write a CHECK constraint that expresses the following
condition on attribute Rating in table Movies in Movie Database: “Any possible
value of Rating is either a null value or a number in the interval from 0 to 10
inclusively”. 

Exercise 2 (2 pts)

Write a CHECK constraint that expresses the following
condition on records in table Laptop in Hardware Database: “If the screen is
larger than 20, then the price is higher than 2000”.

Exercise 3 (2 pts)

Write a CHECK constraint that expresses the following condition
on table Schedule in University Database: “Each course (occurring in this
table) is offered at least two times”. Hint:
Use NOT EXISTS.

Exercise 4 (2 pts)

Write a CHECK constraint that expresses the following
condition on table StarsIn in Movie Database: “Each movie (occurring in this
table) has at most one director”. Hint:
Use NOT EXISTS.

How to submit

1.      
This assignment consists
of `pen-and-paper’ exercises. No SQL files and no copies of SQL tables are
required.Turn in your solutions as a document in the doc, docx, or pdf formats.

 
Powered by