DB2 UDB V8.1 Family Fundamentals
Working with DB2 UDB Objects: Sample Questions 1) If table1 is defined as follows: CREATE TABLE table1 ( id integer NOT NULL, name varchar(20) WITH DEFAULT )
Which INSERT statement will fail? a. b. c. d.
INSERT INSERT INSERT INSERT
INTO INTO INTO INTO
table1 table1 table1 table1
(id) VALUES (1) (name) VALUES (‘tom’) (id, name) VALUES (2, ‘julia’) VALUES (3, ‘ann’)
2) If the following statement is executed: CREATE TABLE newtable LIKE table1
Which of the following is copied from table1? a. indexes b. data types definitions c. triggers d. data 3) What is the difference between a primary key and a unique index? a. There is no difference b. Primary keys are defined on child tables c. The column(s) used for a unique index can contain NULL values d. Primary keys can only be defined using one column 4) When defining a referential constraint, what type of key is defined on the child table? a. foreign b. composite c. unique d. primary 5) When defining a referential constraint, which delete rule will allow rows in the parent table to be deleted when rows in the child table exist? a. restrict b. no action c. set null d. keep
Working with DB2 UDB Objects: Sample Questions
1
DB2 UDB V8.1 Family Fundamentals
6) What is one good reason for storing column data with the index key? a. It is required b. To make the index more unique c. There is extra space d. Improve the performance of some queries 7) For the following statements: CREATE TABLE phonebook (
nameid int, name varchar(50), address varchar(200), phone char(10)) CREATE UNIQUE INDEX nameindex ON phonebook (nameid) INCLUDE (phone)
What will be stored with the index key? a. name b. nameid c. address d. phone 8) Given the following statements: CREATE TABLE students (
studentid integer NOT NULL, course char(4),
CONSTRAINT courses CHECK ( course IN (‘MATH’, ‘CHEM’, ‘ENG1’, ‘HIST’)) NOT ENFORCED ENABLE QUERY OPTIMIZATION )
Which INSERT statement will NOT fail? a. b. c. d.
INSERT INSERT INSERT INSERT
INTO INTO INTO INTO
students students students students
VALUES VALUES VALUES VALUES
(11111, ‘MATH’) (22222, MATH) (‘22222’, ‘CHEM’) (11111, ‘GEOG’)
9) When defining a referential constraint, which delete rule will delete related rows in dependent tables when a row in the parent table is deleted? a. restrict b. set null c. cascade d. no action
Working with DB2 UDB Objects: Sample Questions
2
DB2 UDB V8.1 Family Fundamentals
10) Which of the following command is not valid? a. CREATE INDEX b. ALTER TABLE c. DROP INDEX d. ALTER VIEW
Working with DB2 UDB Objects: Sample Questions
3
DB2 UDB V8.1 Family Fundamentals Answers: 1. b 2. b 3. c 4. a 5. c 6. d 7. d 8. a 9. c 10. d
Working with DB2 UDB Objects: Sample Questions
4