What is a constraint?
A relationship among data elements that the DBMS is required to enforce
When are triggers executed?
When a specified condition occurs
Ex. Insertion of a tuple
What is another name for a foreign key?
referential integrity
For a foreign key, what must referenced attributes be declared?
PRIMARY KEY
or
UNIQUE
If there is a foreign key constraint from relation T1 to relation T2, what two violations are possible?
An insert or update to T1 introduces values not found in T2
A deletion or update to T2 causes some tuples of T1 to dangle
What are the three ways we can handle a deletion or update of T2 (the table that is referenced in a foreign key)?
What is the default case?
Reject the modification
What does cascade do?
Make the same changes in T1 that were made it T2
What does Set NULL do?
Change the affected tuples to NULL, but only the attribute that is a foreign key of the table that was changed
To choose policies for a foreign key what do you follow the foreign key declaration with?
ON [UPDATE, DELETE] [SET NULL CASCADE] then choose what you want from the brackets
What happens if you do not choose policies for a foreign key?
The default (reject the statement) is used
When are attribute based checks performed?
ONLY when a value for that attribute is inserted or updated