DB2 Interview Questions

What is DB2 (IBM Database 2)?

DB2 is a subsystem of the MVS operating system. It is a Database Management System (DBMS) for that operating system.

What is an access path?

The path that is used to get to data specified in SQL statements.

What is an alias?

It is an alternate name that can be used in SQL statements to refer to a table or view in the same or remote DB2 subsystem.

Explain what a plan is?

Plan is a DB2 object (produced during the bind process) that associates one or more database request modules with a plan name.

What is a DB2 bind?

Bind is a process that builds “access paths” to DB2 tables. A bind uses the Database Request Modules(s) (DBRM(s)) from the DB2 pre-compile step as input and produces an application plan. It also checks the user’s authority and validates the SQL statements in the DBRM(s).

What information is used as input to the bind process?

The database request module produced during the pre-compile. The SYSIBM.SYSSTMT table of the DB2 catalog.

What is meant by the attachment facility?

The attachment facility is an interface between DB2 and TSO, IMS/VS, CICS, or batch address spaces. It allows application programs to access DB2.

What is meant by AUTO COMMIT?

AUTO COMMIT is a SPUFI option that commits the effects of SQL statements automatically if they are successfully executed.

What is a base table?

A base table is a real table - a table that physically exists in that there are physical stored records..

What is the function of buffer manager?

The buffer manager is the DB2 component responsible for physically transferring data between an external medium and (virtual) storage (performs the actual I/O operations). It minimizes the amount of physical I/O actually performed with sophisticated buffering techniques(i.e., read-ahead buffering and look-aside buffering).

I use CS and update a page. Will the lock be released after I am done with that page?


What is a buffer pool?

A buffer pool is main storage that is reserved to satisfy the buffering requirements for one or more tablespaces or indexes, and is made up of either 4K or 32K pages.

On the create tablespace, what does the CLOSE parameter do?

CLOSE physically closes the tablespace when no one is working on the object. DB2 (release 2.3) will logically close tablespaces.

What is a Database Request Module(DBRM)?

A DBRM is a DB2 component created by the DB2 pre-compiler containing the SQL source statements extracted from the application program. DBRMs are input to the bind process.

What is a data page?

A data page is a unit of retrievable data, either 4K or 32K (depending on how the table is defined), containing user or catalog information.

What are data types?

They are attributes of columns, literals, and host variables. The data types are SMALLINT, INTEGER, FLOAT, DECIMAL, CHAR, VARCHAR, DATE and TIME.

What will the COMMIT accomplish?

COMMIT will allow data changes to be permanent. This then permits the data to be accessed by other units of work. When a COMMIT occurs, locks are freed so other applications can reference the just committed data.

What is meant by concurrency?

Concurrency is what allows more than one DB2 application process to access the same data at essentially the same time. Problems may occur, such as lost updates, access to uncommitted data, and un-repeatable reads.

What is cursor stability?

It is cursor stability that “tells” DB2 that database values read by this application are protected only while they are being used. (Changed values are protected until this application reaches the commit point). As soon as a program moves from one row to another, other programs may read or the first row.

What is the function of the Data Manager?

The Data Manager is a DB2 component that manager the physical databases. It invokes other system components, as necessary, to perform detailed functions such as locking, logging, and physical I/O operations (such as search, retrieval, update, and index maintenance).

How many buffer pools are there in DB2?

There are four buffer pools: BP0, BP1, BP2, and BP32.

What will the FREE command do to a plan?

It will drop(delete) that existing plan.

What is a host variable?

This is a data item that is used in an SQL statement to receive a value or to supply a value. It must be preceded by a colon (:) to tell DB2 that the variable is not a column name.

What will the DB2 optimizer do?

The optimizer is a DB2 component that processes SQL statements and selects the access paths.

What is a page?

This is the unit of storage within a table space or indexspace that is accessed by DB2.

What is pagespace?

Pagespace refers to either to an unpartitioned table, to an index space, or to a single partition of a partitioned table of index space.

What is a predicate?

A predicate is an element of a search condition that expresses or implies a comparison operation.

What is a recovery log?

A recovery log is a collection of records that describes the sequence of events that occur in DB2. The information is needed for recovery in the event of a failure during execution.

Where are plans stored?

Each plan is defined uniquely in the SYSIBM.SYSPLANS table to correspond to the transaction (s) that are to execute that plan.

What is meant by repeatable read?

When an application program executes with repeatable read protection, rows referenced by the program can’t be changed by other programs until the program reaches a commit point.

Describe what a storage group(STOGROUP) is?

A STOGROUP is a named collection of DASD volumes to be used by tablespaces and index spaces of databases. The volumes of STOGROUP must be of the same device type.

What is the format (internal layout) of “TIMESTAMP”?

This is a seven part value that consists of a date (yymmdd) and time(hhmmss and microseconds).

What is meant by a unit of recovery?

This is a sequence of operations within a unit of work(i.e., work done between commit points).

Can DASD types assigned to storage groups be intermixed(i.e., 3350s and 3380s)?


What are the three types of page locks that can be held?

Exclusive, update, and share.

Can DB2 be accessed by TSO users? If yes, which command is used to invoke DB2?

DB2 can be invoked by TSO users by using the DSN RUN command.

How are write I/Os from the buffer pool executed?


What is a DB2 catalog?

The DB2 catalog is a set of tables that contain information about all of the DB2 objects(tables, views, plans etc.).

In which column of which DB2 catalog would you find the length of the rows for all tables?


What information is held in SYSIBM.SYSCOPY?

The SYSIBM.SYSCOPY table contains information about image copies made of the table spaces.

What information is contained in a SYSCOPY entry?

Included is the name of the database, the table space name, and the image copy type(full or incremental etc.,) as well as the date and time each copy was made.

What information can you find in SYSIBM.SYSLINKS table?

The SYSIBM.SYSLINKS table contains information about the links between tables created by referential constraints.

Where would you find information about the type of database authority held by the user?


Where could you look if you had a question about whether a column has been defined as an index?

This information can be found in SYSIBM.SYSINDEXES.

where would information about the view be stored?

When a view is created, system information about the view is stored in SYSIBM.SYSVIEWS.

What is the SQL Communications Area and what are some of its key fields?

It is a data structure that must be included in any host-language program using SQL. It is used to pass feedback about the sql operations to the program. Fields are return codes, error messages, handling codes and warnings.

What is DCLGEN?

Declarations Generator: used to create the host language copy books for the table definitions. Also creates the DECLARE table.

What are the contents of a DCLGEN?

EXEC SQL DECLARE TABLE statement which gives the layout of the table/view in terms of DB2 data types.

A host language copy book that gives the host variable definitions for the column names.

Is it mandatory to use DCLGEN? If not, why would you use it at all?

It is not mandatory to use DCLGEN. Using DCLGEN, helps detect wrongly spelt column names etc. during the pre-compile stage itself (because of the DECLARE TABLE ). DCLGEN being a tool, would generate accurate host variable definitions for the table reducing chances of error.

Is DECLARE TABLE in DCLGEN necessary? Why it used?

It not necessary to have DECLARE TABLE statement in DCLGEN. This is used by the pre-compiler to validate the table-name, view-name, column name etc., during pre-compile.

Will precompile of an DB2-COBOL program, if DB2 is down?

No. Because the precompiler does not refer to the DB2 catalogue tables.

Name some fields from SQLCA.


How can you quickly find out the number of rows updated after an update statement?

Check the value stored in SQLERRD(3).

What is EXPLAIN?

EXPLAIN is used to display the access path as determined by the optimizer for a SQL statement. It can be used in SPUFI (for single SQL statement) or in BIND step (for embedded SQL). The results of EXPLAIN is stored in U.PLAN_TABLE where U is the authorization id of the user

What do you need to do before you do EXPLAIN?

Make sure that the PLAN_TABLE is created under the AUTHID.

Where the output of is EXPLAIN stored?


EXPLAIN has output with MATCHCOLS = 0. What does it mean?

A no matching index scan if ACCESSTYPE = I.

How do you do the EXPLAIN of a dynamic SQL statement?

There are two methods to achieve this:

1. Use SPUFI or QMF to EXPLAIN the dynamic SQL statement

2. Include EXPLAIN command in the embedded dynamic SQL statements

What are the various locking levels available?


How does DB2 determine what lock-size to use?

There are three methods to determine the lock-size. They are:

1. Based on the lock-size given while creating the table space

2. Programmer can direct the DB2 what lock-size to use

3. If lock-size ANY is specified, DB2 usually chooses a lock-size of PAGE

What are the disadvantages of PAGE level lock?

High resource utilization if large updates are to be done

What is lock escalation?

Promoting a PAGE lock-size to table or table space lock-size when a transaction has acquired more locks than specified in NUMLKTS. Locks should be taken on objects in single table space for escalation to occur.

What are the various locks available?


Can I use LOCK TABLE on a view?

No. To lock a view, take lock on the underlying tables.

What is ALTER?

SQL command used to change the definition of DB2 objects.

What is a DBRM, PLAN?

DBRM: Data Base Request Module, has the SQL statements extracted from the host language program by the pre-compiler.

PLAN: A result of the BIND process. It has the executable code for the SQL statements in the DBRM.


Determine the point at which DB2 acquires or releases locks against table and table spaces, including intent locks.

What else is there in the PLAN apart from the access path?

PLAN has the executable code for the SQL statements in the host program

What happens to the PLAN if index used by it is dropped?

Plan is marked as invalid. The next time the plan is accessed, it is rebound.

What are PACKAGES?

They contain executable code for SQL statements for one DBRM.

What are the advantages of using a PACKAGE?

The advantages of using PACKAGE are:

1. Avoid having to bind a large number of DBRM members into a plan

2. Avoid cost of a large bind

3. Avoid the entire transaction being unavailable during bind and automatic rebind of a plan

4. Minimize fallback complexities if changes result in an error.

What is the physical storage length of each of the following DB2 data types: DATE, TIME, TIMESTAMP?

DATE: 4bytes

TIME: 3bytes

TIMESTAMP: 10bytes

What is the COBOL picture clause of the following DB2 data types: DATE, TIME, TIMESTAMP?


TIME : PIC X(08)


What is the COBOL picture clause for a DB2 column defined as DECIMAL(11,2)?

PIC S9(9)V99 COMP-3.

Assuming that a site's standard is that pgm name = plan name, what is the easiest way to find out which programs are affected by change in a table's structure?

Query the catalogue tables SYSPLANDEP and SYSPACKDEP.

What are the isolation levels possible?

CS: Cursor Stability

RR: Repeatable Read

What is the difference between CS and RR isolation levels?

CS: Releases the lock on a page after use.

RR: Retains all locks acquired till end of transaction

When do you specify the isolation level? How?

During the BIND process(ISOLATION LEVEL is a parameter for the bind process). i.e.ISOLATION ( CS/RR )

What is a collection?

A user defined name that is the anchor for packages. It has not physical existence. Main usage is to group packages.

In SPUFI suppose you want to select maximum of 1000 rows, but the select returns only 200 rows. What are the 2 SQLCODEs that are returned?

+100 (for successful completion of the query), 0 (for successful COMMIT if AUTOCOMMIT is set to Yes).

How would you print the output of an SQL statement from SPUFI?

Print the output dataset.

What is dynamic SQL?

Dynamic SQL is a SQL statement created at program execution time.

When is the access path determined for dynamic SQL?

At run time, when the PREPARE statement is issued.

How does DB2 store NULL physically?

As an extra-byte prefix to the column value. Physically, the null prefix is Hex '00' if the value is present and Hex 'FF' if it is not.

How do you retrieve the data from a nullable column?

Use null indicators. Syntax ... INTO :HOSTVAR:NULLIND

What is the picture clause of the null indicator variable?

S9(4) COMP.

What does it mean if the null indicator has -1, 0, -2?

-1 : the field is null;

0 : the field is not null;

-2 : the field value is truncated

How do you insert a record with a nullable column?

To insert a NULL, move -1 to the null indicator, To insert a valid value, move 0 to the null indicator


A DB2 utility used to collect statistics about the data values in tables which can be used by the optimizer to decide the access path. It also collects statistics used for space management. These statistics are stored in DB2 catalog tables.

What is a clustering index?

It is a type of index that (1) locates table rows and (2) determines how rows are grouped together in the table space.

What does DSNDB07 database do?

DSNDB07 is where DB2 does its sorting. It includes DB2’s sort work area and external storage.

How do you leave the cursor open after issuing a COMMIT?

Use WITH HOLD option in DECLARE CURSOR statement. But, it has not effect in psuedo-conversational CICS programs.

When will you chose to run RUNSTATS?

After a load, or after mass updates, inserts, deletes, or after REORG.

Give some example of statistics collected during RUNSTATS?

Number of rows in the table, Percent of rows in clustering sequence, Number of distinct values of indexed column, Number of rows moved to a nearby/fairway page due to row length increase

What is REORG? When is it used?

REORG reorganizes data on physical storage to reclutser rows, positioning overflowed rows in their proper sequence, to reclaim space, to restore free space. It is used after heavy updates, inserts and delete activity and after segments of a segmented table space have become fragmented.


It is full backup of a DB2 table which can be used in recovery.

When do you use the IMAGECOPY?

To take routine backup of tables, After a LOAD with LOG NO and After REORG with LOG NO

What is COPY PENDING status?

A state in which, an image copy on a table needs to be taken, In this status, the table is available only for queries. You cannot update this table. To remove the COPY PENDING status, you take an image copy or use REPAIR utility.


When a table is LOADed with ENFORCE NO option, then the table is left in CHECK PENDING status. It means that the LOAD utility did not perform constraint checking.

What is QUIESCE?

A QUIESCE flushes all DB2 buffers on to the disk. This gives a correct snapshot of the database and should be used before and after any IMAGECOPY to maintain consistency.

What is a clustering index?

Causes the data rows to be stored in the order specified in the index. A mandatory index defined on a partitioned table space.

How many clustering indexes can be defined for a table?

Only one.

What is the difference between primary key & unique index ?

Primary Key: a relational database constraint. Primary key consists of one or more columns that uniquely identify a row in the table. For a normalized relation, there is one designated primary key.

Unique index: a physical object that stores only unique values. There can be one or more unique indexes on a table.

What is sqlcode -922 ?

Authorization failure

What is sqlcode -811?

SELECT statement has resulted in retrieval of more than one row.

What does the sqlcode of -818 pertain to?

This is generated when the consistency tokens in the DBRM and the load module are different.

If I have a view which is a join of two or more tables, can this view be updatable?


Are views updatable?

Not all of them. Some views are updatable e.g. single table view with all the fields or mandatory fields. Examples of non-updatable views are views which are joins, views that contain aggregate functions (such as MIN), and views that have GROUP BY clause.

What is an inner join, and an outer join ?

Inner Join: combine information from two or more tables by comparing all values that meet the search criteria in the designated column or columns of one table with all the values in corresponding columns of the other table or tables. This kind of join which involve a match in both columns are called inner joins.

Outer join : Is one in which you want both matching and non matching rows to be returned. DB2 has no specific operator for outer joins, it can be simulated by combining a join and a correlated sub query with a UNION.

What is FREEPAGE and PCTFREE in TABLESPACE creation?

PCTFREE: percentage of each page to be left free

FREEPAGE: Number of pages to be loaded with data between each free page

What are simple, segmented and partitioned table spaces?

Simple Table space: Can contain one or more tables. Rows from multiple tables can be interleaved on a page under the DBA’s control and maintenance

Segmented Table space: Can contain one or more tables. Table space is divided into segments of 4 to 64 pages in increments of 4 pages. Each segment is dedicated to single table. A table can occupy multiple segments

Partitioned Table space: Can contain one table. Table space is divided into parts and each part is put in a separate VSAM dataset.

What is filter factor?

One divided by the number of distinct values of a column.

What is index cardinality?

The number of distinct values a column or columns contain.

What is a synonym?

Synonym is an alternate name for a table or view used mainly to hide the leading qualifier of a table or view.. A synonym is accessible only by the creator.

What is the difference between SYNONYM and ALIAS?

SYNONYM: is dropped when the table or tablespace is dropped. Synonym is available only to the creator.

ALIAS: is retained even if table or tablespace is dropped. ALIAS can be created even if the table does not exist. It is used mainly in distributed environment to hide the location information from programs. Alias is a global object & is available to all.

What do you mean by NOT NULL? When will you use it?

The column cannot have nulls. Use it for key fields.

What do you mean by NOT NULL WITH DEFAULT? When will you use it?

This column cannot have nulls and while insertion, if no value is supplied then it will have zeroes, spaces or date/time depending on whether it is numeric, character or date/time. Use it when you do not want to have nulls but at the same time cannot give values all the time you insert this row.

When would you prefer to use VARCHAR?

When a column which contains long text, e.g. remarks, notes, may have in most cases less than 50% of the maximum length.

What are the disadvantages of using VARCHAR?

Can lead to high space utilization if most of the values are close to maximum.

Positioning of VARCHAR column has to be done carefully as it has performance implications.

Relocation of rows to different pages can lead to more I/Os on retrieval.

When is the authorization check on DB2 objects done - at BIND time or run time?

At run time.

Max number of columns in a db2 table?


What is JOIN and different types of JOIN?

The ability to join rows and combine data from two or more tables is one of the most powerful features of relational system.

Three type of joins:

1. Equi-join

How many sub queries can you combine together?

Total 16 queries and sub queries are 15

How many buffer pools are available in db2?

Ten 32k size buffer pools and fifty 4k size buffer pools (bp0 to bp49) default buffer pools are bp0,bp1,bp2 & bp32

B37 abend during SPUFI

The b37 abend in the SPUFI is because of space requirements , the query has resulted in so many rows that the SPUFI. out file is not large enough to handle it, increase the space allocation of SPUFI out file.

What is the error code -803 ?

unique index violation

How do you filter out the rows retrieved from a Db2 table?

One way is to use The SQL WHERE clause.

What is a collection?

Collection is something that every programmer should assign/Specify for every package. this about 1-18 characters long.

What is Skeleton cursor table (SKCT)?

The Executable form of a Plan. This is stored in sysibm.sct02 table.

Can we declare DB2 HOST variable in COBOL COPY book?

NO. If we declare DB2 host variable in COBOL COPY book, at the time of Pre-compilation we get the host variable not defined, because pre-compiler will not expand COBOL COPY book. So we declare it either in DCLGEN with EXEC SQL INCLUDE DCLGEN name END-EXEC or we directly hardcode it in the working storage section.

What should be specified along with a cursor in order to continue updating process after commit?

With Hold option.

What is the name of the default db2 catalog database?


What is a correlated sub query?

In a sub query, if the outer query refers back to the outcome of inner query it is called correlated sub query. That's why the outer query is evaluated first unlike an ordinary sub query

What are the functions of Bind?

BIND mainly performs two things syntax checking and authorization checking. It binds together all packages into an application plan hence the name BIND. Apart from this bind has optimizer as a subcomponent. Its function is to determine the optimum access strategy.

Max. No of rows per page


What is the size of a data page?

4K to 8K

What's the error code for Unique Index Violation?


Can you define an Index if the table size less than 10 PAGES?


What's the Maximum Length of SQLCA and what's the content of SQLCABC?

The Max length is 136. and the SQLCABC has the Value of SQLCA.

What's the maximum number of volumes that can be added to a STOGROUP?

133.Usually it will be difficult monitor more than 3 or 4 volumes to a Storage group.

What's the maximum number of characters that a table name can have?

The answer is 18 characters.

What is the meaning of -805 SQL return code?

Program name not in plan. Bind the plan and include the DBRM for the program named as part of the plan.

What is the difference between TYPE 1 index & TYPE 2 index

TYPE 1 & TYPE 2 are specified when an index is created on the table. TYPE 2 index is the option which comes with DB2V4. With TYPE 2 index data can be retrieved faster as only the data pages are locked and not the index pages. Hence TYPE 2 index is recommended.

What are the levels of isolation available with DB2 v4?

CS RR UR (added new for DB2V4 which stands for uncommitted read which allows to retrieve records from the space which has exclusive locks also but data integrity will be affected if this option is used )The best available option for data integrity & data concurrency is CS.

What is the difference between Where and Having Clause

WHERE is for Rows and HAVING is for Groups

What is the maximum number of tables that can be stored on a Partitioned Table Space?


What are the max. & min. no. of partitions allowed in a partition table space?

minimum is 4. maximum is 64.

What is the maximum number of tables that can be joined?


What is a DB2 bind?

DB2 bind is a process that builds an access path to DB2 tables.

What is a DB2 access path?

An access path is the method used to access data specified in DB2 SQL statements.

What is a DB2 plan?

An application plan or package is generated by the bind to define an access path.

What is normalization and what are the five normal forms?

Normalization is a design procedure for representing data in tabular format. The five normal forms are progressive rules to represent the data with minimal redundancy.

What are foreign keys?

These are attributes of one table that have matching values in a primary key in another table, allowing for relationships between tables.

What is a view? Why use it?

A view is a virtual table made up of data from base tables and other views, but not stored separately.

What is a sub select? Is it different from a nested select?

A sub select is a select which works in conjunction with another select. A nested select is a kind of sub select where the inner select passes to the where criteria for the outer select.

What is the difference between group by and order by?

Group by controls the presentation of the rows, order by controls the presentation of the columns for the results of the SELECT statement.

What is a cursor and what is its function?

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.

What is referential integrity?

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.

What is the database descriptor?

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

What is lock contention?

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.

What is SPUFI?

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

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

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.

What is a synonym? How is it used?

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.

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

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.

What is a LIKE table and how is it created?

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.

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

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

What is the self-referencing constraint?

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?

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.

How does DB2 use multiple table indexes?

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

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

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 a clustered index?

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 are some SQL aggregates and other built-in functions?

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

How is the SUBSTR keyword used in sql?

SUBSTR is used for string manipulation with column name, first position and string length used as arguments.

Explain transactions, commits and rollbacks in DB2.

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?

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 three lock types?

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?

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.

What is an intent lock?

An intent lock is at the table level for a segmented tablespace or at the tablespace level for a non-segmented tablespace. They indicate at the table or tablespace level the kinds of locks at lower levels.

What is cursor stability?

Cursor stability means that DB2 takes a lock on the page the cursor is accessing and releases the lock when the cursor moves to another page.

What is the significance of the CURSOR WITH HOLD clause in a cursor declaration?

The clause avoids closing the cursor and repositioning it to the last row processed when the cursor is reopened.

What is the difference between IN subselects and EXISTS subselect?

If there is an index on the attributes tested an IN is more efficient since DB2 uses the index for the IN.

What is a lock?

A lock is the mechanism that controls access to data pages and tablespaces.

What is meant by isolation level?

This is a key concept for any relational database. Isolation level is the manner in which locks are applied and released during a transaction. For DB2 a 'repeatable read' holds all locks untile the transaction completes or a syncpoint is issued. For transactions using 'cursor stability' the page lock releases are issued as the cursor 'moves', i.e. as the transaction releases addressability to the records.

What is a precompiler?

It is a DB2 facility for static SQL statements - it replaces these statements with calls to the DB2 language interface module

What does the CHECK Utility do ?

The CHECK Utility checks the referential integrity of table relations and checks the integrity of the indexes by matching index column values to table column values.

What are column-name qualifiers used?

Column-name qualifier are used as table designator to avoid ambiguity when the column names referenced exist in more than one table used in the SQL statement. Column-name qualifiers are used in correlated references.

What are correlation names?

It is a special type of column designator that connects specific column in the various levels of a multilevel SQL query.

What is correlated subquery?

A correlated subquery is one that has a correlation name as a table or view designator in the FROM clause of the outer query and the same correlation name as a qualifier of a search condition in the WHERE clause of the subquery.

What is read-only cursor?

A read-only cursor is one in which the result table was created by a query containing one of the following :

a DISTINCT keyword
a UNION operator
a column or scalar function
a GROUP BY clause
a ORDER BY clause
a HAVING clause
a read-only view in the FROM clause
a FROM clause identifying more than one table or view

Which catalog tables contain authorization information?

The SYSIBM table that contain authorization information are SYSCOLAUTH, SYSDBAUTH, SYSPLANAUTH, SYSTABAUTH and SYSUSERAUTH.