Mainframe DB2 Interview Questions, FAQs along with Answers

9/25/2009 No Comment

Mainframe DB2 Interview Questions, FAQs along with Answers.

What is a LIKE table and how is it created?
Answer : 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.

If the base table underlying a view is restructured, eg attributes are added, does the application code accessing the view need to be redone?
Answer : 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

Under what circumstances will DB2 allow an SQL statement to update more than one primary key value at a time?
Answer : Never Such processing could produce duplicate values violating entity integrity Primary keys must be updated one at a time

What is the cascade rule and how does it relate to deletions made with a Sub Select?
Answer : The cascade rule will not allow deletions based on a Sub Select that references the same table from which the deletions are being made.

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 keyword does an SQL SELECT statement use for a string search?

Answer : The LIKE keyword allows for string searches The % sign is used as wildcard.

What are some SQL aggregates and other built-in functions?
Answer : The common aggregate, built-in functions are AVG, SUM, MIN, MAX,COUNT and DISTINCT.

How is the SUBSTR keyword used in SQL?

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


What are the three DB2 date and time data types and their associated functions?
Answer : 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).

Explain transactions, commits and rollbacks in DB2.

Answer : 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.

What is deadlock?

Answer : 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.

What are the four lockable units for DB2?
Answer : DB2 imposes locks of four differing sizes: pages, tables, table space and for indexes sub page.

What are the three lock types?
Answer : The three types are shared, update and exclusive Shared locks allow two or more programs to read simultaneously but not change the locked space An exclusive lock bars all other users from accessing the space An update lock is less restrictive; it allows other transactions to read or acquire shared locks on the space.

What is isolation level?

Answer : SQL statements may return any number of rows, but most host languages deal with one row at a time by declaring a cursor that presents each row at a unique isolation level.
Related Posts


No comments :

 

Aired | The content is copyrighted and may not be reproduced on other websites. | Copyright © 2009-2016 | All Rights Reserved 2016

Contact Us | About Us | Privacy Policy and Disclaimer