Referential Integrity Flashcards
What does referential integrity mean?
That lookup columns will always have a value and that value will find a match in the destination table.
(Aug. 2021, 5.3)
The referential integrity value that gets assigned is determined by the circumstances behind the null or unmatched value and is defined by the ____ _______.
Load package
Aug. 2021, 5.3
Databases that enforce referential integrity have two important properties. What are they?
- Lookup columns will always have a value even if the source data is null.
- Lookup column values will always have a matching value in the destination table/column.
(Aug. 2021, 5.4)
What default value does Caboodle use to identify Unspecified Values?
-1
Aug. 2021, 5.5
Why is a value said to be unspecified?
When a lookup column’s value is NULL in the source system.
Aug. 2021, 5.5
What default value does Caboodle use to identify Not Applicable values?
-2
Aug. 2021, 5.5
Where would you look to discover why a -2 value is in a key column?
You should investigate that column’s data lineage and the table’s queries.
(Aug. 2021, 5.6)
What does Caboodle do when a record is hard-deleted in the source system?
Caboodle marks the deletion by updating the row with default values that represent the deletion.
(Aug. 2021, 5.6)
Does the primary key of a non-snapshot table change when a record is hard-deleted in the source system?
No. The primary key remains unchanged.
Aug. 2021, 5.6
What value in the _IsDeleted column indicates a deletion?
1
Aug. 2021, 5.7
Does the surrogate key or the durable key change when data is deleted in a SNAPSHOT table?
A new surrogate key is generated. The durable key remains unchanged.
(Aug. 2021, 5.8)
What are the default values Caboodle uses for a deletion?
String columns = *Deleted
Lookup columns = -3
Everything Else = NULL
_IsDeleted = 1
(Aug. 2021, 5.7)
What happens when an entity in a snapshot table is deleted?
A new row is added and is populated with the deleted default values.
The other rows pertaining to this entity will be updated to reflect the deletion. Only the snapshot columns will be updated with the deleted default values. The data in non-snapshot columns is now stale.
(Aug. 2021, 5.7-5.8)
How does Caboodle ensure the second principal of referential integrity?
Every table in Caboodle has three special rows with primary key values of -1, -2, and -3. These rows do not represent actual entities, they only exist to satisfy referential integrity.
(Aug. 2021, 5.16)
Why do the “Three Special Rows” exist?
- So that the second principal of referential integrity is satisfied.
- So we can join to them if we need to (tidbit from class)
(Aug. 2021, 5.16)