1.11 Referential Integrity Flashcards

1
Q

fully NULL

A

A fully NULL foreign key is a simple or composite foreign key in which all columns are NULL.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Referential integrity

A

Referential integrity is a relational rule that requires foreign key values are either fully NULL or match some primary key value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

RESTRICT constraint

A

RESTRICT rejects an insert, update, or delete that violates referential integrity.

Applies to primary key update and delete, and foreign key insert and update

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

SET NULL constraint

A

SET NULL sets invalid foreign keys to NULL.

Applies to primary key update and delete, and foreign key insert and update

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

SET DEFAULT constraint

A

SET DEFAULT sets invalid foreign keys to the foreign key default value.

Applies to primary key update and delete, and foreign key insert and update

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

CASCADE constraint

A

CASCADE propagates (extends/applies) primary key changes to foreign keys.

Applies to primary key update and delete only.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

ON UPDATE / ON DELETE

A

Actions are specified in the optional ON UPDATE and ON DELETE clauses of the FOREIGN KEY constraint. ON UPDATE and ON DELETE are followed by either RESTRICT, SET NULL, SET DEFAULT, or CASCADE.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Referential integrity violations for composite foreign keys

A

Primary key is updated or deleted.
Foreign key is updated or inserted

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does CASCADE do when a primary key is deleted?

A

Rows containing matching foreign keys are deleted.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does CASCADE do if a primary key is updated?

A

matching foreign keys are updated to the same value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly