0% found this document useful (0 votes)
67 views4 pages

Working With DB2 UDB Data: Sample Questions: SELECT FROM Table1, Table2

This document contains 10 sample questions about working with data in DB2 UDB databases. The questions cover data types, joins, result set ordering, set operations, updates, views, stored procedures and the ALTER TABLE statement. The correct answers to each question are provided at the end.

Uploaded by

praveen123j
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views4 pages

Working With DB2 UDB Data: Sample Questions: SELECT FROM Table1, Table2

This document contains 10 sample questions about working with data in DB2 UDB databases. The questions cover data types, joins, result set ordering, set operations, updates, views, stored procedures and the ALTER TABLE statement. The correct answers to each question are provided at the end.

Uploaded by

praveen123j
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

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 Table2
1 3
2 4
5

How many rows will be returned if the following statement is executed?

SELECT * FROM Table1, Table2

a. 0
b. 3
c. 5
d. 6

4) Using Table1 from question 3, which SELECT statement will return a result set
with no duplicates?
a. SELECT DISTINCT * FROM Table1
b. SELECT UNIQUE * FROM Table1
c. SELECT DISTINCT (*) FROM Table1
d. SELECT 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 class grade
bob math 99
ann math 95
tom chem 85
bob chem 99

Which statement will change bob’s grade in math from 99 to 85?


a. UPDATE grades SET grade=85 WHERE grade=99
b. UPDATE TABLE grades SET grade=85 WHERE name=’bob’ AND
class=’math’
c. UPDATE grades SET grade=85 WHERE name=’bob’ AND
class=’math’
d. UPDATE grades SET grade=85 WHERE 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. INSERT INTO view1 VALUES (150)
b. INSERT INTO view1 VALUES (125)
c. INSERT INTO view1 VALUES (200)
d. INSERT INTO view1 VALUES (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. run proc1 (‘A0’, ?)
b. call proc1 (A0, ‘?’)
c. proc1 (‘A0’, ?)
d. 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

You might also like