DB2 UDB V8.1 Family Fundamentals
Working with DB2 UDB Data: Sample Questions 1) To store the price of items with a maximum price of 99999.99, which data type do you use? a. numeric(5,2) b. double c. decimal(7,2) d. money 2) Which two of the following data types can be used to store double byte data? a. graphic b. varchar c. BLOB d. DBCLOB 3) Given the following tables: Table1 1 2
Table2 3 4 5
How many rows will be returned if the following statement is executed? SELECT * FROM Table1, Table2
a. b. c. d.
0 3 5 6
4) Using Table1 from question 3, which SELECT statement will return a result set with no duplicates? a. b. c. d.
SELECT SELECT SELECT SELECT
DISTINCT * FROM Table1 UNIQUE * FROM Table1 DISTINCT (*) FROM Table1 UNIQUE (*) FROM Table1
Working with DB2 UDB Data: Sample Questions
1
DB2 UDB V8.1 Family Fundamentals
5) For the following SELECT statement: SELECT * FROM employee What is true about the order of the result set? a. ascending order b. descending order c. no order d. order data was entered 6) Which operator is used to retrieve the set of values which exist in the first table, but not the second in a query? a. Left Outer Join b. Except c. Only d. Where 7) Given the following table: grades name bob ann tom bob
class math math chem chem
grade 99 95 85 99
Which statement will change bob’s grade in math from 99 to 85? a. UPDATE grades SET grade=85 WHERE b. UPDATE TABLE grades SET grade=85 class=’math’ c. UPDATE grades SET grade=85 WHERE class=’math’ d. UPDATE grades SET grade=85 WHERE
grade=99 WHERE name=’bob’ AND name=’bob’ AND name=’bob’
8) Given the following statements: CREATE TABLE table1 (col1 INTEGER, check (col1 > 100)) CREATE VIEW view1 AS SELECT col1 FROM table1 WHERE col1 > 150
Which of the following INSERT statement will fail? a. b. c. d.
INSERT INSERT INSERT INSERT
INTO INTO INTO INTO
view1 view1 view1 view1
VALUES VALUES VALUES VALUES
(150) (125) (200) (100)
Working with DB2 UDB Data: Sample Questions
2
DB2 UDB V8.1 Family Fundamentals
9) Which of the following cannot occur with the ALTER TABLE statement? a. Change the name of a column b. Drop an index c. Drop a foreign key d. Add a column 10) Given the following stored procedure: CREATE PROCEDURE proc1 (IN id char(2), OUT code int)
How can it be invoked from the Command Line Processor (CLP)? a. b. c. d.
run proc1 (‘A0’, ?) call proc1 (A0, ‘?’) proc1 (‘A0’, ?) call proc1 (‘A0’, ?)
Working with DB2 UDB Data: Sample Questions
3
DB2 UDB V8.1 Family Fundamentals Answers: 1. c 2. a, d 3. d 4. a 5. c 6. b 7. c 8. d 9. a 10. d
Working with DB2 UDB Data: Sample Questions
4