Test your knowledge of DB2 9 by answering the questions below, which are from a real, previous DB2 9 Fundamentals certification exam (Exam 730). When you make your answer selection, click on "Get Answer" to check your answers and read the explanations. If you haven't done so already, be sure to take part 1 and part 2 of this DB2 9 quiz series about tables.

Sample Questions
Question 1
Which of the following are NOT stored in the system catalog tables?:
A. SQL statements used to create tables
B. SQL statements used to create triggers
C. SQL statements used to create constraints
D. Table names
Get answer

Question 2
Assuming table TAB1 contains 100 rows, which of the following queries will return only half of the rows available?
A. SELECT * FROM tab1 FIND FIRST 50 ROWS
B. SELECT * FROM tab1 FETCH FIRST 50 ROWS ONLY
C. SELECT * FROM tab1 WHILE ROW_NUM < 50
D. SELECT * FROM tab1 MAXROWS 50
Get answer

Question 3
If the following statement is executed:
CREATE TABLE employee
(empid INT NOT NULL GENERATED BY DEFAULT
AS IDENTITY (START WITH 1, INCREMENT BY 5),
name VARCHAR(20),
dept INT CHECK (dept BETWEEN 1 AND 20),
hiredate DATE WITH DEFAULT CURRENT DATE,
salary DECIMAL(7,2),
PRIMARY KEY(empid),
CONSTRAINT cst1 CHECK (YEAR(hiredate) > 2006 OR
Salary > 60500));
Which of the following INSERT statements will fail?
A. INSERT INTO employee VALUES (15, 'Smith', 5, '01/22/2004', 92500.00)
B. INSERT INTO employee VALUES (DEFAULT, 'Smith', 2, '10/07/2002', 80250.00)
C. INSERT INTO employee VALUES (20, 'Smith', 5, NULL, 65000.00)
D. INSERT INTO employee VALUES (DEFAULT, 'Smith', 10, '11/18/2004', 60250.00)
Get answer

Question 4
Which of the following modes, when used with the LOCK TABLE statement, will cause the DB2 Database Manager to acquire a table-level lock that prevents other concurrent transac-tions from accessing data stored in the table while the owning transaction is active?
A. SHARE MODE
B. ISOLATED MODE
C. EXCLUSIVE MODE
D. RESTRICT MODE
Get answer

Question 5
Given the following table:
TAB1
COL1 COL2
A 10
B 20
C 30
A 10
D 40
C 30
Assuming the following results are desired:
TAB1
COL1 COL2
A 10
B 20
C 30
D 40
Which of the following statements will produce the desired results?
A. SELECT UNIQUE * FROM tab1
B. SELECT DISTINCT * FROM tab1
C. SELECT UNIQUE(*) FROM tab1
D. SELECT DISTINCT(*) FROM tab1
Get answer

Question 6
Given the following tables:
YEAR_2006
EMPID NAME
1 Jagger, Mick
2 Richards, Keith
3 Wood, Ronnie
4 Watts, Charlie
5 Jones, Darryl
6 Leavell, Chuck
YEAR_1962
EMPID NAME
1 Jagger, Mick
2 Richards, Keith
3 Jones, Brian
4 Wyman, Bill
5 Chapman, Tony
6 Stewart, Ian
If the following SQL statement is executed, how many rows will be returned?
SELECT name FROM year_2006
UNION
SELECT name FROM year_1962
Get answer

Question 7
Which of the following is NOT a characteristic of a unique index?
A. Each column in a base table can only participate in one unique index, regard-less of how the columns are grouped (the same column can not be used in mul-tiple unique indexes)
B. In order for an index to be used to support a unique constraint, it must have been defined with the UNIQUE attribute
C. A unique index cannot be created for a populated table if the key column speci-fied contains more than one NULL value
D. A unique index can only be created for a non-nullable column
Get answer

Question 8
Which of the following causes a lock that is being held by an application using the Cursor Stability isolation level to be released?
A. The cursor is moved to another row
B. The row the cursor is on is deleted by the application
C. The row the cursor is on is deleted by another application
D. The row the cursor is on needs to be updated by another application
Get answer

Question 9
If the following SQL statements are executed in the order shown:
CREATE TABLE table1 (c1 INTEGER, c2 INTEGER);
INSERT INTO table1 VALUES (123, 456);
UPDATE table1 SET c1 = NULL;
What will be the result of the following statement?
SELECT * FROM table1;
A. C1 C2
123 456
1 record(s) selected.
B. C1 C2
NULL 456
1 record(s) selected.
C. C1 C2
- 456
1 record(s) selected.
D. C1 C2
0 456
1 record(s) selected.
Get answer

Question 10
Given the following table definition:
SALES
INVOICE_NO CHAR(20) NOT NULL
SALES_DATE DATE
SALES_PERSON CHAR(20)
REGION CHAR(20)
SALES INTEGER
If the following SELECT statement is executed, which of the following describes the order of the rows in the result data set produced?
SELECT * FROM sales
A. The rows are sorted by INVOICE_NO in ascending order.
B. The rows are sorted by INVOICE_NO in descending order.
C. The rows are ordered based on when they were inserted into the table.
D. The rows are not sorted in any particular order.
Get answer
