Suppose you are not allowed to use the FOREIGN KEY clause. How can you express foreignkey constraints?

For example, suppose we have a table Professor with attributes Id, name, etc., where Id is
the primary key and a table Teaches with attributes ProfId, CrsCode, etc. How would you
specify the constraint that each professor teaches exactly one course?


Use the following SQL assertion:


CREATE ASSERTION EachProfTeachExactlyOneCourse
CHECK (NOT EXISTS
(SELECT * FROM Professor P
WHERE (SELECT COUNT(*) FROM Teaches A
WHERE P.Id = T.ProfId) <> 1))

Computer Science & Information Technology

You might also like to view...

The main method executes in the ________ thread of execution.

a. starting b. main c. local d. None of the above.

Computer Science & Information Technology

Which of the following properties creates a 3D shadow effect like the kind in the accompanying figure?

A. 3D-shadow B. box-shadow C. drop-shadow D. h-shadow

Computer Science & Information Technology

Even if you change the color of a page background using the Page Color button under the DESIGN tab, the colored background may still not print

Indicate whether the statement is true or false

Computer Science & Information Technology

What is a directed path?

What will be an ideal response?

Computer Science & Information Technology