EXERCISES

8.1 Define the terms type constraint and database constraint. When are such constraints checked? What happens if the check fails?

8.2 State The Golden Rule. Is it true that this rule can be violated if and only if some individually declared single relvar constraint is violated?

8.3 What do you understand by the following terms?—assertion; attribute constraint; base table constraint; column constraint; multirelvar constraint; referential constraint; relvar constraint; row constraint; single relvar constraint; state constraint; “the” (total) database constraint; “the” (total) relvar constraint; transition constraint; tuple constraint. Which of these categories if any do (a) key constraints, (b) foreign key constraints, fall into?

8.4 Distinguish between possible and physical representations.

8.5 With the Tutorial D definition of type QTY as given in the body of the chapter, what do the following expressions return?

  1. THE_Q ( QTY ( 345 ) )

  2. QTY ( THE_Q ( QTY ) )

8.6 Explain as carefully as you can (a) what a selector is; (b) what a THE_ operator is. Note: This exercise essentially repeats ones in previous chapters, but now you should be able to be more specific in your answers.

8.7 Suppose the only legal CITY values are London, Paris, Rome, Athens, Oslo, Stockholm, Madrid, and Amsterdam. Define a Tutorial D type called CITY that satisfies this constraint.

8.8 Following on from the previous exercise, show how you could impose the corresponding constraint in SQL on the CITY columns in ...

Get SQL and Relational Theory, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.