FAQs(316 to 330)

316) What is the self-referencing constraint?

A) 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.

317) What are delete-connected tables?

A) 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.

318) When can an insert of a new primary key value threaten referential integrity?

A) 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.

319) In terms of DB2 indexing, what is the root page?

A) 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.

320) How does DB2 use multiple table indexes?

A) DB2 use the multiple indexes to satisfy multiple predicates in a SELECT statement that are joined by an AND or OR. 

321) What are some characteristics of columns that benefit from indexes?

A) 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.

322) What is a composite index and how does it differ from a multiple index?

A) 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.

323) What is meant by index cardinality?

A) 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.

324) What is a clustered index?

A) 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.

325) What keyword does an SQL SELECT statement use for a string search?

A) The LIKE keyword allows for string searches. The % sign is used as a wildcard.

326) What are some SQL aggregates and other built-in functions?

A) The common aggregate, built-in functions are AVG, SUM, MIN, MAX, COUNT and DISTINCT.

327) How is the SUBSTR keyword used in sql?

A) SUBSTR is used for string manipulation with column name, first position and string length used as arguments. E.g. SUBSTR (NAME, 1 3) refers to the first three characters in the column NAME.

328) What are the three DB2 date and time data types and their associated functions?

A) The three data types are DATE, TIME and TIMESTAMP. CHAR can be used to specify the format of each type. The DAYS function calculates the number of days between two dates. (It's Y2K compliant).

329) Explain transactions, commits and rollbacks in DB2.

A) In DB2 a transaction typically requires a series of updates, insertions and deletions that represent a logical unit of work. A transaction puts an implicit lock on the DB2 data. Programmers can use the COMMIT WORK statement to terminate the transaction creating smaller units for recovery. If the transaction fails DB2 uses the log to roll back values to the start of the transaction or to the preceding commit point.

330) What is deadlock?

A) Deadlock occurs when transactions executing at the same time lock each other out of data that they need to complete their logical units of work.