FAQs(301 to 315)

301) What is a cursor and what is its function?

A) An embedded SQL statement may return a number of rows while the programming language can only access one row at a time. The programming device called a cursor controls the position of the row.

302) What is referential integrity?

A) Referential integrity refers to the consistency that must be maintained between primary and foreign keys, i.e. every foreign key value must have a corresponding primary key value.

303) Usually, which is more important for DB2 system performance - CPU

processing or I/O access?

A) I/O operations are usually most critical for DB2 performance (or any other database for that matter).

304) Is there any advantage to denormalizing DB2 tables?

A) Denormalizing DB2 tables reduces the need for processing intensive relational joins and reduces the number of foreign keys.

305) What is the database descriptor?

A) The database descriptor, DBD is the DB2 component that limits access to the database whenever objects are created, altered or dropped.

306) What is lock contention?

A) To maintain the integrity of DB2 objects the DBD permits access to only on object at a time. Lock contention happens if several objects are required by contending application processes simultaneously.

307) What is SPUFI?

A) SPUFI stands for SQL processing using file input. It is the DB2 interactive menu-driven tool used by developers to create database objects.

308) What is the significance of DB2 free space and what parameters control it?

A) The two parameters used in the CREATE statement are the PCTFREE which specifies the percentage of free space for each page and FREEPAGE which indicates the number of pages to be loaded with data between each free page. Free space allows room for the insertion of new rows.

309) What is a NULL value? What are the pros and cons of using NULLS?

A) A NULL value takes up one byte of storage and indicates that a value is not present as opposed to a space or zero value. It's the DB2 equivalent of TBD on an organizational chart and often correctly portrays a business situation. Unfortunately, it requires extra coding for an application program

to handle this situation.

310) What is a synonym? How is it used?

A) A synonym is used to reference a table or view by another name. The other name can then be written in the application code pointing to test tables in the development stage and to production entities when the code is migrated. The synonym is linked to the AUTHID that created it.

311) What is an alias and how does it differ from a synonym?

A) An alias is an alternative to a synonym, designed for a distributed environment to avoid having to use the location qualifier of a table or view. The alias is not dropped when the table is dropped.

312) What is a LIKE table and how is it created?

A) A LIKE table is created by using the LIKE parameter in a CREATE table statement. LIKE tables are typically created for a test environment from the production environment.

313) If the base table underlying a view is restructured, eg. attributes are added, does the application code accessing the view need to be redone?

A) No. The table and its view are created anew, but the programs accessing the view do not need to be changed if the view and attributes accessed remain the same.

314) Under what circumstances will DB2 allow an SQL statement to update more than one primary key value at a time?

A) Never. Such processing could produce duplicate values violating entity integrity. Primary keys must be updated one at a time.

315) What is the cascade rule and how does it relate to deletions made with a subselect?

A) The cascade rule will not allow deletions based on a subselect that references the same table from which the deletions are being made.