DB2 Self-referencing Constraints Questions
- What is the self-referencing constraint?
Answer: The self-referencing constraint limits in a single table the changes to a primary key that the related foreign key defines.
The foreign key in a self referencing table must specify the DELETE CASCADE rule.
- What are delete-connected tables?
Answer: Tables related with a foreign key are called delete-connected because a deletion in the primary key table can affect the contents of the foreign key table.
- When can an insert of a new primary key value threaten referential integrity?
Answer: Never. New primary key values are not a problem. However, the values of foreign key inserts must have corresponding primary key values in their related tables, and updates of primary key values may require changes in foreign key values to maintain referential integrity.
- In terms of DB2 indexing, what is the root page?
Answer:The simplest DB2 index is the B-tree and the B-tree's top page is called the root page.
The root page entries represent the upper range limits of the index and are referenced first in a search.
- How does DB2 use multiple table indexes ?
Answer: DB2 use the multiple indexes to satisfy multiple predicates in a SELECT statement that are joined by an AND or OR.
- What are some characteristics of columns that benefit from indexes?
Answer: Primary key and foreign key columns; columns that have unique values; columns that have aggregates computed frequently and columns used to test the existence of a value.
- What is a composite index and how does it differ from a multiple index?
Answer: A multiple index is not one index but two indexes for two different columns of a table.
A composite index is one index made up of combined values from two columns in a table. If two columns in a table will often be accessed together a composite index will be efficient.
- What is meant by index cardinality?
Answer: The number of distinct values for a column is called index cardinality.
DB2's RUNSTATS utility analyzes column value redundancy to determine whether to use a tablespace or index scan to search for data.
- What is a clustered index?
Answer: For a clustered index DB2 maintains rows in the same sequence as the columns in the index for as long as there is free space. DB2 can then process that table in that order efficiently.
- What keyword does an SQL SELECT statement use for a string search?
Answer: The LIKE keyword allows for string searches. The % sign is used as a wildcard.