SQL Contraints and Triggers Flashcards
What does the keyword UNIQUE do?
Declares keys
What do the keywords NOT NULL do?
Disallows null values
What do the keywords PRIMARY KEY do?
It is a combination of key + not null
What do the keywords FOREIGN KEY do?
References attributes in other tables
_____ values are ignored when checking constraints
NULL
_____ uniquely identify the tuples of a relation
KEYS
How do you declare a key with more than one attribute?
UNIQUE (p1, p2)
What are 3 ways to handle a deletion of an property referred to by a foreign key?
- Reject
- Propogate
- Set to NULL
A _______ rejects updates/insertions of the condition is false
CHECK
A _______ is a datatype with optional constraints
DOMAIN
An _______ is a CHECK constraint not bound to a specific table
ASSERT
What are 3 components of a trigger?
- Event (update, delete, etc)
- Condition
- Action (make queries, examine)
TRIGGERS are processed in a _______ order
arbitrary
A collection of TRIGGERS can have ______________ effects
unpredictable