Sei sulla pagina 1di 48

700

SQL
1. Given a SELECT statement that has a GROUP BY clause.
The HAVING clause uses the same syntax as which other clause?
A. WHERE
B. UNION
C. SUBQUERY
D. ORDER BY

2. Which of the following statements will create an index and prevent table T1 from containing
two or more
rows with the same values for column C1?
A. CREATE UNIQUE INDEX ix1 ON t1 (c1)
B. CREATE DISTINCT INDEX ix1 ON t1 (c1)
C. CREATE UNIQUE INDEX ix1 ON t1 (c1,c2)
D. CREATE DISTINCT INDEX ix1 ON t1 (c1,c2)

3. Which of the following is the result of the following SQL statement:


CREATE UNIQUE INDEX empno_ind ON employee (empno)
A. Every value for EMPNO must be unique.
B. UPDATE statements on EMPNO will be rolled back.
C. INSERT statements on EMPNO will always be faster.
D. INSERT statements on the EMPNO table will result in clustered data.

64.Which of the following is the outcome of the following SQL statements?


CREATE TABLE employee (empno INT, empname CHAR (30))
CREATE UNIQUE INDEX empno_ind ON employee (empno)
A. Every value for EMPNO will be different.
B. Multiple NULL values are allowed in the EMPNO column.
C. An additional unique index cannot be created on the EMPLOYEE table.
D. INSERT statements on the EMPLOYEE table will result in clustered data.

4. Which of the following statements eliminates all but one of each set of repeated rows in the
final result
table?
A. SELECT UNIQUE * FROM t1
B. SELECT DISTINCT * FROM t1
C. SELECT * FROM DISTINCT T1
D. SELECT UNIQUE (*) FROM t1
E. SELECT DISTINCT (*) FROM t1

5. What is the difference between a unique index and a primary key?


A. They are different terms for the same concept.
B. Unique indexes can be defined over multiple columns.Primary keys must have only one column.
C. Unique indexes can be defined in ascending or descending order. Primary keys must be ascending.
D. Unique indexes can be defined over a column or columns that allow nulls. Primary keys cannot
contain
nulls.

6. Which of the following can be accomplished with a single UPDATE statement?


A. Updating multiple tables
B. Updating a view consisting of joined tables
C. Updating multiple tables based on a WHERE clause
D. Updating a table based on a sub-select using joined tables

7. Which of the following tasks can be performed using the ALTER TABLESPACE statement?
A. ASSING a bufferpool
B. Change the table space name
C. Change the type of the table space
D. Change the page size of the table space

8.Which two of the following can be done using the ALTER TABLE statement?
A. Add a trigger.
B. Define an index.
C. Drop a table alias.
D. Add an INTEGER column.
E. Define a unique constraint.

9.Which two of the following can be done using the ALTER TABLE statement?
A. Define a trigger.
B. Define a primary key.
C. Add a check constraint.
D. Add a non-unique index.
E. Change a column's name.

10. Which of the following SQL statements can remove all rows from a table named
COUNTRY?
A. DELETE country
B. DELETE FROM country
C. DELETE * FROM country
D. DELETE ALL FROM country

11. Which of the following is the result of the following SQL statement:
ALTER TABLE talbw1 ADD col2 INT WITH DEFAULT
A. The statement fails with a negative SQL code
B. The statement fails because no default value is specified
C. A new column called COL2 is added to TABLE1 and populated with zeros
D. A new column called COL2 is added to TABLE1 and populated with nulls
E. A new column called COL2, which cannot contains nulls, is added to TABLE1

65.Given the SQL statement:


ALTER TABLE table1 ADD col2 INT WITH DEFAULT
Which of the following is the result of the statement?
A. The statement fails because no default value is specified.
B. A new column called COL2 is added to TABLE1 which would have a null value if selected.
C. A new column called COL2 is added to TABLE1 which would have a value of zero if selected.
D. A new column called COL2 is added to TABLE1 which would require the default value to be set
before
working with the table.

12. Which of the following DDL statements creates a table where employee IDs are unique?
A. CREATE TABLE t1 (employid INTEGER)
B. CREATE TABLE t1 (employid INTEGER GENERATED BY DEFAULT AS IDENTITY)
C. CREATE TABLE t1 (employid INTEGER NOT NULL)
D. CREATE TABLE t1 (employid INTEGER NOT NULL PRIMARY KEY)
13. Given the table T1, created by:
CREATE TABLE t1
(id INTEGER GENERATED BY DEFAULT AS IDENTITY,
c1 CHAR(3)
)
The following SQL statements are issued:
INSERT INTO t1 VALUES (1, �ABC�)
INSERT INTO t1 VALUES (5, �DEF�)
Which of the following values are inserted into the ID column by the following statement?
INSERT INTO t1(c1) VALUES (�XYZ�)?
A. 0
B. 1
C. 2
D. 5
E. 6

14. Given the table T1 created by:


CREATE TABLE t1
(id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY,
c1 CHAR(10) NOT NULL,
c2 CHAR(10)
)
Which of the following INSERT statement will succeed?
A. INSERT INTO t1 VALUES (1, �abc�, NULL)
B. INSERT INTO t1 VALUES (1, NULL, �def�)
C. INSERT INTO t1(c1, c2) VALUES (�abc�, NULL)
D. INSERT INTO t1(c1, c2) VALUES (NULL, �def�)

15. Given the following statement:


CREATE TABLE t1 (c1 CHAR(4) NOT NULL)
Which of the following can be inserted into this table?
A. 4
B. NULL
C. 'abc'
D. 'abcde'

16. CREAT DISTINCT TYPE kph AS INTEGER WITH COMPARISONS


CREAT DISTINCT TYPE mph AS INTEGER WITH COMPARISONS
CREAT TABLE speed_limits
(route_num SMALLINT,
canada_sl KPH NOT NULL,
us_sl MPH NOT NULL)
Which of the following is a valid quary?
A. SELECT route_num FROM speed_limits WHERE canada_sl > 80
B. SELECT route_num FROM speed_limits WHERE canada_sl > kph
C. SELECT route_num FROM speed_limits WHERE canada_sl > us_sl
D. SELECT route_num FROM speed_limits WHERE canada_sl > kph(80)

18. Given the statement:


CREATE TABLE t1
(c1 INTEGER NOT NULL,
c2 INTEGER
PRIMARY KEY (c1)
FOREIGN KEY (c2) REFERENCES t2)
How many non-unique indexes are defined for table t1?
A. 0
B. 1
C. 2
D. 3

19.Given the following:


CREATE TABLE tab1 (c1 char(3) WITH DEFAULT NULL, c2 INTEGER);
INSERT INTO tab1(c2) VALUES (345);
What will be the result of the following statement if issued from the Command Line Processor?
SELECT * FROM tab1;
A. C1 C2
--- -----------
0 record(s) selected.
B. C1 C2
--- -----------
123 345
1 record(s) selected.
C. C1 C2
--- -----------
345
1 record(s) selected.
D. C1 C2
--- -----------
- 345
1 record(s) selected.

20.Given the following information:


CREATE TABLE tab1 (c1 CHAR(4), c2 INTEGER)
INSERT INTO tab1 VALUES ('123',345)
UPDATE tab1 SET (c1, c2) = (NULL,0)
What will be the result of the following statement if issued in the Command Line Processor?
SELECT * FROM tab1;
A. C1 C2
---- -----------
-0
1 record(s) selected.
B. C1 C2
---- -----------
123 345
1 record(s) selected.
C. C1 C2
---- -----------
NULL 0
1 record(s) selected.
D. C1 C2
---- -----------
123 0
1 record(s) selected.}

21. Given the following statements:


Create table mytab
{
Col1 int not null primary key,
Col2 char(64),
Col3 char(32),
Col4 int not null,
Constraint c4 unique (Col4, Col1)
}
How many indexes will be created by the following statement?
A. 0
B. 1
C. 2
D. 3
E. 4

22. Given the following table structure:


table1
emp_num INT NOT NULL PRIMARY KEY
emp_frame CHAR(30) NOT NULL
emp_lname CHAR(30) NOT NULL
emp_addr CHAR(60) NOT NULL
emp_pin CHAR(10) NOT NULL
Which of the following columns can be referenced by a foreign key clause from anther table?
A. emp_num
B. emp_pin
C. emp_addr
D. emp_frame
E. emp_lname

23. Given the tables:


TABLEA TABLEB
empid name empid weeknumber paycheck
1 JOE 1 1 1000.00
2 BOB 1 2 1000.00
2 1 2000.00
TABLEB was defined as follows:
CREATE TABLE tableb (empid CHAR(3), weeknumber CHAR(3), paycheck DECIMAL(6, 2),
CONSTRAINT const1 FROEIGN KEY(empid)
REFERENCES tablea (empid) ON DELETE SET NULL)
How many rows would be deleted from tableb if the following command is issued:
DELETE FROM tablea WHERE empid=�2�?
A. 0
B. 1
C. 2
D. 3

24. Given the following SQL statements:


CREATE TABLE tab1 (col1 INT)
CREATE TABLE tab2 (col1 INT)
INSERT INTO tab1 VALUES (NULL), (1)
INSERT INTO tab2 VALUES (NULL), (1)
SELECT COUNT(*) FROM tab1
WHERE col1 IN
(SELECT col1 FROM tab2)
Which of the following is the result of the SELECT COUNT(*) statement?
A. 1
B. 2
C. 3
D. 4
E. 0

25. Given the following DDL statement:


CREATE TABLE newtab1 LIKE tab1
Which of the following would occur as a result of the statement execution?
A. NEWTAB1 has same triggers as TAB1
B. NEWTAB1 is populated with TAB1 data
C. NEWTAB1 has the same primary key as TAB1
D. NEWTAB1 columns have same attributes as TAB1

66.Given the following DDL statement:


CREATE TABLE newtab1 LIKE tab1
Which of the following would occur as a result of the statement execution?
A. NEWTAB1 would have the same column names and attributes as TAB1
B. NEWTAB1 would have the same column names, attributes, and data as TAB1
C. NEWTAB1 would have the same column names, attributes, indexes, and constraints as TAB1
D. NEWTAB1 would have the same column names, attributes, and referential integrity as TAB1

60.Given the following statements:


CREATE TABLE t1 (col1 INT NOT NULL);
ALTER TABLE t1 ADD CONSTRAINT t1_ck CHECK (col1 in (1,2,3));
INSERT INTO t1 VALUES (3);
CREATE TABLE t2 LIKE t1;
DROP TABLE t1;
Which of the following is the result of these statements?
A. Both tables are dropped.
B. T2 is an empty table with the check constraint.
C. T2 is an empty table without the check constraint.
D. T2 contains 1 row and is defined with the check constraint.
E. T2 contains 1 row and is defined without the check constraint.

26. Given the table definition:


CREATE TABLE student (name CHAR(30), age INTEGER)
To list the names of the 10 youngest students, which of the following index definition statements
on the
student table may improve the query performance?
A. CREATE INDEX youngest ON student (age, name)
B. CREATE INDEX youngest ON student (name , age)
C. CREATE INDEX youngest ON student (name , age DESC)
D. CREATE INDEX youngest ON student (name , age DESC) INCLUDE (age)

28. Given table T1 with 100 rows, which of the following queries will retrieve 10 rows from table
T1?
A. SELECT * FROM t1 MAXIMUM 10 ROWS
B. SELECT * FROM t1 READ 10 ROWS ONLY
C. SELECT * FROM t1 OPTIMIZE FOR 10 ROWS
D. SELECT * FROM t1 FETCH FIRST 10 ROWS ONLY
70.Given table T1 with 100 rows, which of the following queries will retrieve 10 rows from table
T1?
A. SELECT * FROM t1 MAXIMUM 10 ROWS
B. SELECT * FROM t1 TOP 10 ROWS ONLY
C. SELECT * FROM t1 OPTIMIZE FOR 10 ROWS
D. SELECT * FROM t1 FETCH FIRST 10 ROWS ONLY

83.Given table T1 with 100 rows, which of the following queries will retrieve 10 rows from table
T1?
A. SELECT * FROM t1 MAXIMUM 10 ROWS
B. SELECT * FROM t1 TOP 10 ROWS ONLY
C. SELECT * FROM t1 OPTIMIZE FOR 10 ROWS
D. SELECT * FROM t1 FETCH FIRST 10 ROWS ONLY

29. With tables defined as:


Table1
col INT
col2 CHAR(30)
Table2
col INT
col2 CHAR(30)
Which of the following statements will insert all the rows in TABLE2 into TABLE1?
A. INSERT INTO table1 SELECT col1, col2 FROM table2
B. INSERT INTO table1 AS SELECT col1, col2 FROM table2
C. INSERT INTO table1 VALUES(table2.col1, table2.col2)
D. INSERT INTO table1 VALUES (SELECT col1, col2 FROM table2)
E. INSERT INTO table1(col1, col2) VALUES(SELECT col1, col2 FROM table2)

93.Given tables that are defined in the following way:


Table1
col1 INT
col2 CHAR(30)
Table2
col1 INT
col2 CHAR(30)
Which of the following statements will insert all the rows in TABLE2 into TABLE1?
A. INSERT INTO table1 (table2.col1, table2.col2)
B. INSERT INTO table1 SELECT col1, col2 FROM table2
C. INSERT INTO table1 VALUES (SELECT col1, col2 FROM table2)
D. INSERT INTO table1 (col1,col2) VALUES (SELECT col1,col2 FROM table2

30. Given the table definition:


DEFIN1:
id SMALLINT NOT NULL
name VARCHAR(30)
hired DATE
DEFIN2:
deptid SMALLINT NOT NULL
name VARCHAR(30)
started DATE
Which of the following statements will insert successfully into table DEFIN1?
A. INSERT INTO defin1 (id) VALUES (1)
B. INSERT INTO defin1 (name) VALUES (�Florence�)
C. INSERT INTO defin1 (id, hired) AS SELECT DISTINCT 1, CURRENT DATE FROM defin2
D. INSERT INTO defin1 (name, hired) SELECT DISTINCT �Florence�, CURRENT DATE
FROM defin2

92.Given the table definitions:


DEFIN1:
id SMALLINT NOT NULL
name VARCHAR(30)
hired DATE
DEFIN2:
deptid SMALLINT NOT NULL
name VARCHAR(30)
started DATE
Assuming that neither table is empty, which of the following statements will insert data
successfully
into table DEFIN1?
A. INSERT INTO defin1 (id) VALUES (1)
B. INSERT INTO defin1 (name) VALUES ('Florence')
C. INSERT INTO defin1 (id, hired) AS SELECT DISTINCT 1, CURRENT DATE FROM defin2
D. INSERT INTO defin1 (name, hired) SELECT DISTINCT 'Florence', CURRENT DATE FROM
defin2

73.Given the table definitions:


DEFIN1:
id SMALLINT NOT NULL
name VARCHAR(30)
hired DATE
DEFIN2:
deptid SMALLINT NOT NULL
name VARCHAR(30)
started DATE
Assuming that neither table is empty, which of the following statements will insert data
successfully
into table DEFIN1?
A. INSERT INTO defin1 (id) VALUES (1)
B. INSERT INTO defin1 (name) VALUES ('Florence')
C. INSERT INTO defin1 (id, hired) AS SELECT DISTINCT 1, CURRENT DATE FROM defin2
D. INSERT INTO defin1 (name, hired) SELECT DISTINCT 'Florence', CURRENT DATE FROM
defin2

31. Given table EMPLOYEE with columns EMPNO and SALARY and table JOB with columns
ID and
TITLE, what is the effect of the statement:
UPDATE employee SET salary=salary * 1.15
WHERE salary<15000 OR EXISTS(SELECT 1 FROM job WHERE job.id=employee.empno
AND
job.title=�Mgr�)
A. Only manager that make less than 15,000 are given salary increases
B. Only non-manager that make less than 15,000 are given salary increases
C. Employees that make less than 15,000 but no managers are given salary increases
D. Employees that make less than 15,000 and all managers are given salary increases
90.Given table EMPLOYEE with columns EMPNO and SALARY, and table JOB with columns
ID and
TITLE, what is the effect of the following statement?
UPDATE employee SET salary = salary * 1.15
WHERE salary < 15000 OR
EXISTS (SELECT 1 FROM job WHERE job.id = employee.empno AND job.title =
'MANAGER')
A. Employees who make less than 15,000 and all managers are given salary increases.
B. Only employees who are managers that make less than 15,000 are given salary increases.
C. Employees who are not managers and who make less than 15,000 are given salary increases.
D. Only employees who are not managers or make less than 15,000 are given salary increases.

32. Given the following:


TAB1 TAB2
C1 C2 CX CY
����
A 11 A 21
B 12 C 22
C 13 D 23
The following results are desired:
C1 C2 CX CY
����
A 11 A 21
C 13 C 22
� � D 23
Which of the following joins will yield the desired results?
A. SELECT * FORM tab1, tab2 WHERE c1=cx
B. SELECT * FORM tab1INNER JOIN tab2 ON c1=cx
C. SELECT * FORM tab1FULL OUTER JOIN tab2 ON c1=cx
D. SELECT * FORM tab1 RIGHT OUTER JOIN tab2 ON c1=cx

68.Given the following two tables:


TAB1 TAB2
C1 C2 CX CY
--- ---- ----- ----
A 11 A 21
B 12 C 22
C 13 D 23
The following results are desired:
C1 C2 CX CY
---- ---- ---- ----
A 11 A 21
C 13 C 22
- - D 23
Which of the following joins will yield the desired results?
A. SELECT * FROM tab1 INNER JOIN tab2 ON c1=cx
B. SELECT * FROM tab2 FULL OUTER JOIN tab1 ON c1=cx
C. SELECT * FROM tab2 RIGHT OUTER JOIN tab1 ON c1=cx
D. SELECT * FROM tab1 RIGHT OUTER JOIN tab2 ON c1=cx
33. Given the following:
TAB1 TAB2
C1 C2 CX CY
����
A 11 A 21
B 12 C 22
C 13 D 23
The following results are desired:
C1 C2 CX CY
����
A 11 A 21
B 12 � �
C 13 C 22
Which of the following joins will yield the desired results?
A. SELECT * FORM tab1, tab2 WHERE c1=cx
B. SELECT * FORM tab1INNER JOIN tab2 ON c1=cx
C. SELECT * FORM tab1FULL OUTER JOIN tab2 ON c1=cx
D. SELECT * FORM tab1 LEFT OUTER JOIN tab2 ON c1=cx

34. Given the following UPDATE statement:


UPDATE address2 SET housenumber_buildingname=
(SELECT buildingname FROM address1
WHERE address2.id=address1.id)
WHERE HOUSENUMBER_BUILDINGNAME IS NULL
Which of the following describes the result of the statement?
A. The statement will succeed.
B. The statement will fail because a subquery cannot exist in an UPDATE statement.
C. The statement will succeed only if ADDRESS1.ID and ADDRESS2.ID are defined as primary
keys.
D. The statement will succeed only if the data retrieved from the subquery does not have duplicate
values for
ASSRESS1.ID.

69.Given the following UPDATE statement:


UPDATE address2 SET house_building=
(SELECT building FROM address1
WHERE address2.id = address1.id)
WHERE house_building IS NULL
Which of the following describes the result of the statement?
A. The statement will succeed.
B. The statement will fail because a subquery cannot exist in an UPDATE statement.
C. The statement will succeed only if ADDRESS1.ID and ADDRESS2.ID are defined as primary
keys.
D. The statement will succeed if the data retrieved from the subquery does not have duplicate values
for
ADDRESS1.ID.

35. Given the following DDL statements:


CREATE TABLE t1 (a INT, b INT, c INT)
CREATE VIEW v1 AS SELECT a, b, c FROM t1
WHERE a>250 WITH CHECK OPTION
Which of the following INSERT statements will fail?
A. INSERT INTO t1 VALUES (200, 2, 3)
B. INSERT INTO v1 VALUES (200, 2, 3)
C. INSERT INTO t1 VALUES (300, 2, 3)
D. INSERT INTO v1 VALUES (300, 2, 3)
36. Given the following statements:
CREATE TABLE t4
(c1 INTEGER NOT NULL,
c2 INTEGER,
c3 DECIMAL(7,2) NOT NULL,
c4 CHAR(20) NOT NULL);
CREATE UNIQUE INDEX i4 ON t4(c1,c3);
ALTER TABLE t4 ADD PRIMARY KEY (c1,c3);
Which of the following statements is TRUE?
A. The ALTER TABLE statement will fail.
B. The primary key will use the I4 unique index.
C. A primary index will need to be created on the composite key (C1,C3).
D. An additional unique index will automatically be created on the composite key (C1,C3).

37. The table STOCK has the following column definitions:


type CHAR(1)
status CHAR(1)
quantity INTEGER
price DEC (7,2)
items are indicated to be out of stock by setting STATUS to NULL and QUANTITY and PRICE
to zero.
Which of the following statements updates the STOCK table to indicate that all the items except
for those
with TYPE of "S" are temporarily out of stock?
A. UPDATE stock SET status='NULL', quantity=0, price=0 WHERE type <> 'S'
B. UPDATE stock SET (status, quantity, price) = (NULL, 0, 0) WHERE type <> 'S'
C. UPDATE stock SET (status, quantity, price) = ('NULL', 0, 0) WHERE type <>'S'
D. UPDATE stock SET status = NULL, SET quantity=0, SET price = 0 WHERE type <>'S'

38. Given the two following tables:


NAMES
Name Number
Wayne Gretzky 99
Jaromir Jagr 68
Bobby Orr 4
Bobby Hull 23
Brett Hull 16
Mario Lemieux 66
Steve Yzerman 19
Claude Lemieux 19
Mark Messier 13
Mats Sundin 11
POINTS
Name Points
Wayne Gretzky 244
Jaromir Jagr 168
Bobby Orr 129
Bobby Hull 93
Brett Hull 121
Mario Lemieux 189
Joe Sakic 94
Which of the following statements will display the player’s names, numbers and points for
players with an
entry in both tables?
A. SELECT names.name, names.number, points.points FROM names INNER JOIN points ON
names.name=points.name
B. SELECT names.name, names.number, points.points FROM names FULL OUTER JOIN points ON
names.name=points.name
C. SELECT names.name, names.number, points.points FROM names LEFT OUTER JOIN points ON
names.name=points.name
D. SELECT names.name, names.number, points.points FROM names RIGHT OUTER JOIN points
ON
names.name=points.name

85.Given the two following tables:


Tablename: NAMES
Name Number
Wayne Gretzky 99
Jaromir Jagr 68
Bobby Orr 4
Bobby Hull 23
Brett Hull 16
Mario Lemieux 66
Steve Yzerman 19
Claude Lemieux 19
Mark Messier 11
Mats Sundin 13
Tablename:POINTS
Name Points
Wayne Gretzky 244
Jaromir Jagr 168
Bobby Orr 129
Bobby Hull 93
Brett Hull 121
Mario Lemieux 189
Joe Sakic 94
Which of the following statements will display the player's name, number and points for all
players
with an entry in both tables?
A. SELECT names.name, names.number, points.points FROM names INNER
JOIN points ON names.name=points.name
B. SELECT names.name, names.number, points.points FROM names FULL
OUTER JOIN points ON names.name=points.name
C. SELECT names.name, names.number, points.points FROM names LEFT
OUTER JOIN points ON names.name=points.name
D. SELECT names.name, names.number, points.points FROM names RIGHT
OUTER JOIN points ON names.name=points.name

86.Given the two following tables:


POINTS
Name Points
Wayne Gretzky 244
Jaromir Jagr 168
Bobby Orr 129
Bobby Hull 93
Brett Hull 121
Mario Lemieux 189
PIM
Name PIM
Mats Sundin 14
Jaromir Jagr 18
Bobby Orr 12
Mark Messier 32
Brett Hull 66
Mario Lemieux 23
Joe Sakic 94
Which of the following statements will display the name, points and PIM for players in either
table?
A. SELECT points.name, points.points, pim.name, pim.pim FROM points
INNER JOIN pim ON points.name=pim.name
B. SELECT points.name, points.points, pim.name, pim.pim FROM points FULL
OUTER JOIN pim ON points.name=pim.name
C. SELECT points.name, points.points, pim.name, pim.pim FROM points LEFT
OUTER JOIN pim ON points.name=pim.name
D. SELECT points.name, points.points, pim.name, pim.pim FROM points
RIGHT OUTER JOIN pim ON points.name=pim.name

39. Given the following tables:


NAMES
Name Number
Wayne Gretzky 99
Jaromir Jagr 68
Bobby Orr 4
Bobby Hull 23
Brett Hull 16
Mario Lemieux 66
Steve Yzerman 19
Claude Lemieux 19
Mark Messier 13
Mats Sundin 11
POINTS
Name Points
Wayne Gretzky 244
Jaromir Jagr 168
Bobby Orr 129
Bobby Hull 93
Brett Hull 121
Mario Lemieux 189
PIM
Name PIM
Mats Sundin 14
Jaromir Jagr 18
Bobby Orr 12
Mark Messier 32
Brett Hull 66
Mario Lemieux 23
Joe Sakic 94
Which of the following statements will display the name, number, points and PIM for players
with an entry
in all three tables?
A. SELECT names.name, names.number, points.points, pim.pim FROM names INNER JOIN points
ON
names.name=points.name INNER JOIN pim ON pim.name=names.name
B. SELECT names.name, names.number, points.points, pim.pim FROM names OUTER JOIN points
ON
names.name=points.name OUTER JOIN pim ON pim.name=names.name
C. SELECT names.name, names.number, points.points, pim.pim FROM names LEFT OUTER JOIN
points
ON names.name=points.name LEFT OUTER JOIN pim ON pim.name=names.name
D. SELECT names.name, names.number, points.points, pim.pim FROM names RIGHT OUTER
JOIN points
ON names.name=points.name RIGHT OUTER JOIN pim ON pim.name=names.name

40. Given the two following tables:


POINTS
Name Points
Wayne Gretzky 244
Jaromir Jagr 168
Bobby Orr 129
Bobby Hull 93
Brett Hull 121
Mario Lemieux 189
PIM
Name PIM
Mats Sundin 14
Jaromir Jagr 18
Bobby Orr 12
Mark Messier 32
Brett Hull 66
Mario Lemieux 23
Joe Sakic 94
Which of the following statements will display the player’s names, points and PIM for all
players?
A. SELECT points.name, points.points, pim.name, pim.pim FROM points INNER JOIN pim ON
points.name=pim.name
B. SELECT points.name, points.points, pim.name, pim.pim FROM points FULL OUTER JOIN pim
ON
points.name=pim.name
C. SELECT points.name, points.points, pim.name, pim.pim FROM points LEFT OUTER JOIN pim
ON
points.name=pim.name
D. SELECT points.name, points.points, pim.name, pim.pim FROM points RIGHT OUTER JOIN pim
ON
points.name=pim.name

71.Given the two following tables:


POINTS
Name Points
Wayne Gretzky 244
Jaromir Jagr 168
Bobby Orr 129
Bobby Hull 93
Brett Hull 121
Mario Lemieux 189
PIM
Name PIM
Mats Sundin 14
Jaromir Jagr 18
Bobby Orr 12
Mark Messier 32
Brett Hull 66
Mario Lemieux 23
Joe Sakic 94
Which of the following statements will display the name, points and PIM for players in either
table?
A. SELECT points.name, points.points, pim.name, pim.pim FROM points INNER
JOIN pim ON points.name=pim.name
B. SELECT points.name, points.points, pim.name, pim.pim FROM points FULL
OUTER JOIN pim ON points.name=pim.name
C. SELECT points.name, points.points, pim.name, pim.pim FROM points LEFT
OUTER JOIN pim ON points.name=pim.name
D. SELECT points.name, points.points, pim.name, pim.pim FROM points RIGHT
OUTER JOIN pim ON points.name=pim.name

41. Given the following table definition:


STAFF
id INTEGER
name CHAR(20)
dept INTEGER
job CHAR(20)
years INTEGER
salary DECIMAL(10, 2)
comm DECIMAL(10, 2)
Which of the following SQL statements will return the total number of employees in each
department and
the corresponding department id under the following conditions:
Only return departments with at last one employee receiving a commission greater than 5000.
The result should be sorted by the department count from most to least.
A. SELECT dept, COUNT(id) FROM staff WHERE comm>5000 GROUP BY dept ORDER BY 2
DESC
B. SELECT dept, COUNT(*) FROM staff GROUP BY dept HAVING MAX�comm�>5000
BY 2 DESC
C. SELECT dept, COUNT(*) FROM staff WHERE comm>5000 GROUP BY dept, comm ORDER
BY 2
DESC
D. SELECT dept, comm COUNT(id) FROM staff WHERE comm>5000 GROUP BY dept, comm
ORDER
BY 3 DESC

72.Given the following table definition:


STAFF
id INTEGER
name CHAR(20)
dept INTEGER
job CHAR(20)
years INTEGER
salary DECIMAL(10,2)
comm DECIMAL(10,2)
Which of the following SQL statements will return a result set that satisfies these conditions:
• Displays the total number of employees in each department
• Displays the corresponding department ID for each department
• Includes only departments with at least one employee receiving a commission (comm) greater
than 5000
• Sorted by the department employee count from greatest to least
A. SELECT dept, COUNT(*) FROM staff GROUP BY dept HAVING comm > 5000 ORDER BY 2
DESC
B. SELECT dept, COUNT(*) FROM staff WHERE comm > 5000 GROUP BY dept, comm ORDER
BY 2
DESC
C. SELECT dept, COUNT(*) FROM staffF GROUP BY dept HAVING MAX(comm) > 5000
ORDER BY
2 DESC
D. SELECT dept, comm, COUNT(id) FROM staff WHERE comm > 5000 GROUP BY dept, comm
ORDER BY 3 DESC

89.Given the following table definition:


STAFF
id INTEGER
name CHAR(20)
dept INTEGER
job CHAR(20)
years INTEGER
salary DECIMAL(10,2)
comm DECIMAL(10,2)
Which of the following SQL statements will return a result set that satisfies these conditions:
• Displays the total number of employees in each department
• Displays the corresponding department ID for each department
• Includes only departments with at least one employee receiving a commission (comm) greater
than 5000
• Sorted by the department employee count from greatest to least
A. SELECT dept, COUNT(*) FROM staff GROUP BY dept HAVING comm > 5000 ORDER BY 2
DESC
B. SELECT dept, COUNT(*) FROM staff WHERE comm > 5000 GROUP BY dept, comm ORDER
BY 2
DESC
C. SELECT dept, COUNT(*) FROM staffF GROUP BY dept HAVING MAX(comm) > 5000
ORDER BY
2 DESC
D. SELECT dept, comm, COUNT(id) FROM staff WHERE comm > 5000 GROUP BY dept, comm
ORDER BY 3 DESC

88.Given the following table definition:


STAFF
id INTEGER
name CHAR(20)
dept INTEGER
job CHAR(20)
years INTEGER
salary DECIMAL(10,2)
comm DECIMAL(10,2)
Where the job column contains job types: manager, clerk, and salesperson.
Which of the following statements will return the data with all managers together, all clerks
together,
and all salespeople together in the output?
A. SELECT * FROM staff ORDER BY job
B. SELECT job, name FROM staff GROUP BY name, job
C. SELECT * FROM staff GROUP BY name, job, id, dept, years, salary, comm
D. SELECT * FROM staff ORDER BY name, job, id, dept, years, salary, comm.

42. Given the following table definition:


STAFF
id INTEGER
name CHAR(20)
dept INTEGER
job CHAR(20)
years INTEGER
salary DECIMAL(10, 2)
comm DECIMAL(10, 2)
The job column contains these job types: manager, clerk, and salesperson. Which of the
following
statements will return the data with all manager together, all clerks together and all salespeople
together in
the output?
A. SELECT * FROM staff ORDER BY job
B. SELECT job, name FROM staff GROUP BY name, job
C. SELECT * FROM staff GROUP BY name, job, id, dept, years, salary, comm
D. SELECT * FROM staff ORDER BY name, job, id, dept, years, salary, comm.

43. Given the following table definition:


STAFF
id INTEGER
name CHAR(20)
dept INTEGER
job CHAR(20)
years INTEGER
salary DECIMAL(10, 2)
comm DECIMAL(10, 2)
Which of the following statements will return all of the records ordered by job with the salaries
in
descending order?
A. SELECT * FROM staff ORDER BY salary DESC, job
B. SELECT * FROM staff GROUP BY salary DESC, job
C. SELECT * FROM staff ORDER BY job, salary DESC
D. SELECT * FROM staff GROUP BY job, salary DESC

44. Given the table COUNTRY and the statements below:


COUNTRY
ID NAME PERSON_ID CITIES
1 Argentina 1 10
2 Canada 2 20
3 Cuba 2 10
4 Germany 1 0
5 France 7 5
Which of the following clauses when added to the statement
SELECT cities, name FROM country
Returns rows stored by NAME and then sorted by the number of cities(CITIES)?
A. ORDER BY 2, 1
B. GROUP BY 2, 1
C. ORDER BY cities, name
D. GROUP BY cities, name

45. Given the tables:


COUNTRY
ID NAME PERSON CITIES
1 Argentina 1 10
2 Canada 2 20
3 Cuba 2 10
4 Germany 1 0
5 France 7 5
STAFF
ID LASTNAME
1 Jones
2 Smith
Which of the following statements removes the rows from the COUNTRY table that have
PERSONS in the
STAFF table?
A. DELETE FROM country WHERE id IN (SELECT id FROM staff)
B. DELETE FROM country WHERE id IN (SELECT person FROM staff)
C. DELETE FROM country WHERE person IN (SELECT id FROM staff)
D. DELETE FROM country WHERE person IN (SELECT person FROM staff)

46. Given the table COUNTRY and the statements below:


COUNTRY
ID NAME PERSON_ID CITIES
1 Argentina 1 10
2 Canada 2 20
3 Cuba 2 10
4 Germany 1 0
5 France 7 5
STAFF
ID LASTNAME
1 Jones
2 Smith
COUNTRY(PERSON_ID) is the foreign key for STAFF(ID).
Which of the following statements removes from the COUNTRY table those rows that do not
have a STAFF
person assigned?
A. DELETE FROM country WHERE id IN (SELECT id FROM staff)
B. DELETE FROM country WHERE id NOT IN (SELECT person_id FROM staff)
C. DELETE FROM country WHERE person_id NOT IN (SELECT id FROM staff)
D. DELETE FROM country WHERE person_id IN (SELECT person_id FROM staff)

47. Given the tables:


COUNTRY
ID NAME PERSON CITIES
1 Argentina 1 10
2 Canada 2 20
3 Cuba 2 10
4 Germany 1 0
5 France 7 5
STAFF
ID LASTNAME
1 Jones
Smith
The statement:
INSTER INTO staff SELECT person, ‘Greyson’ FROM country WHERE person>1
Will insert how many rows into the STAFF table?
A. 0
B. 1
C. 2
D. 3

48. Given the tables:


COUNTRY
ID NAME PERSON CITIES
1 Argentina 1 10
2 Canada 2 20
3 Cuba 2 10
4 Germany 1 0
5 France 7 5
STAFF
ID LASTNAME
1 Jones
2 Smith
How many rows would be returned using the following statement?
SELECT * FROM staff, country
A. 0
B. 2
C. 5
D. 7
E. 10

49. Given the table:


STAFF
ID LASTNAME
1 Jones
2 Smith
When issuing the query “SELECT * FROM staff ”,the row return order will be based on which
of the
following?
A. An ambiguous order
B. The primary key order
C. The order that the rows were inserted into the table
D. The values for the ID column, then the LASTNAME column

50. Given the table:


STAFF
ID LASTNAME
1 Jones
Smith
<null>
which of the following statements removes all rows from the table where there is a NULL value
for
LASTNAME?
A. DELETE FROM staff WHERE lastname IS NULL
B. DELETE FROM staff WHERE lastname = “NULL”
C. DELETE ALL FROM staff WHERE lastname IS NULL
D. DELETE ALL FROM staff WHERE lastname = “NULL”

51. Given the following table definitions:


DEPARTMENT
deptno CHAR(3)
deptname CHAR(30)
mgrno I NTEGER
admrdept CHAR(3)
EMPLOYEE
empno INTEGER
firstname CHAR(30)
midinit CHAR
lastname CHAR(30)
workdept CHAR(3)
Which of the following statements will list the employee’s employee number, lastname, and
department
name ONLY for those employees who have a department?
A. SELECT e.empno, e.lastname, e.deptname FROM employee e, department d WHERE e.workdept
=
d.deptno
B. SELECT e.empno, e.lastname, e.deptname FROM employee e LEFT OUTER JOIN department d
ON
e.workdept = d.deptno
C. SELECT e.empno, e.lastname, e.deptname FROM employee e FULL OUTER JOIN department d
ON
e.workdept = d.deptno
D. SELECT e.empno, e.lastname, e.deptname FROM employee e RIGHT OUTER JOIN department d
ON
e.workdept = d.deptno

87.Given the following table definitions:


DEPARTMENT
deptno CHAR(3)
deptname CHAR(30)
mgrno INTEGER
admrdept CHAR(3)
EMPLOYEE
empno INTEGER
firstname CHAR(30)
midinit CHAR
lastname CHAR(30)
workdept CHAR(3)
Given that the result set should only include employees with a department, which of the
following
statements will list each employee's number, last name, and department name?
A. SELECT e.empno, e.lastname, d.deptname FROM employee e, department d
WHERE e.workdept = d.deptno
B. SELECT e.empno, e.lastname, d.deptname FROM employee e LEFT OUTER JOIN department d
ON
e.workdept = d.deptno
C. SELECT e.empno, e.lastname, d.deptname FROM employee e FULL OUTER JOIN department d
ON e.workdept = d.deptno
D. SELECT e.empno, e.lastname, d.deptname FROM employee e RIGHT OUTER JOIN department
d
WHERE e.workdept = d.deptno

52. Given the following table definitions:


DEPARTMENT
deptno CHAR(3)
deptname CHAR(30)
mgrno I NTEGER
admrdept CHAR(3)
EMPLOYEE
empno INTEGER
firstname CHAR(30)
midinit CHAR
lastname CHAR(30)
workdept CHAR(3)
Which of the following statements will produce a result set satisfying these criteria?
* The empno and lastname of every employee
* For each employee, include the empno and lastname of their manager
* Includes employees both with and without a manager
A. SELECT e.empno, e.lastname FROM employee e LEFT OUTER JOIN (department INNER JOIN
employee m ON mgrno = m.empno) ON e.workdept = deptno
B. SELECT e.empno, e.lastname, m.empno, m.lastname FROM employee e LEFT INNER JOIN
(department
INNER JOIN employee m ON mgrno = m.empno) ON e.workdept = deptno
C. SELECT e.empno, e.lastname, m.empno, m.lastname FROM employee e LEFT OUTER JOIN
(department
INNER JOIN employee m ON mgrno = m.empno) ON e.workdept = deptno
D. SELECT e.empno, e.lastname, m.empno, m.lastname FROM employee e RIGHT OUTER JOIN
(department INNER JOIN employee m ON mgrno = m.empno) ON e.workdept = deptno

53. Given the two table definitions:


ORG
deptnumb INTEGER
deptname CHAR(30)
manager INTEGER
division CHAR(30)
location CHAR(30)
EMPLOYEE
id INTEGER
name CHAR(30)
dept INTEGER
job CHAR(20)
years INTEGER
salary DECIMAL(10,2)
comm. DECIMAL(10,2)
Which of the following statements will display each department, alphabetically,by name, and
the name of
the manager of the department?
A. SELECT a.deptname, b.name FROM org a, staff b WHERE a.manager = b.id
B. SELECT a.deptname, b.name FROM org a, staff b WHERE b.manager = a.id
C. SELECT a.deptname, b.name FROM org a, staff b WHERE a.manager = b.id GROUP BY
a.deptname,
b.name
D. SELECT a.deptname, b.name FROM org a, staff b WHERE b.manager = a.id GROUP BY
a.deptname,
b.name

84.Given the two following table definitions:


ORG
deptnumb INTEGER
deptname CHAR(30)
manager INTEGER
division CHAR(30)
location CHAR(30)
STAFF
id INTEGER
name CHAR(30)
dept INTEGER
job CHAR(20)
years INTEGER
salary DECIMAL(10,2)
comm DECIMAL(10,2)
Which of the following statements will display each department, by name, and the total salary of
all
employees in the department?
A. SELECT a.deptname, SUM(b.salary) FROM org a, staff b
WHERE a.deptnumb=b.dept ORDER BY a.deptname
B. SELECT a.deptname, SUM(b.salary) FROM org a, staff b
WHERE a.deptnumb=b.dept GROUP BY a.deptname
C. SELECT a.deptname, SUM(b.salary) FROM org a INNER JOIN staff b
ON a.deptnumb=b.dept ORDER BY a.deptname
D. SELECT b.deptname, SUM(a.salary) FROM org a INNER JOIN staff b
ON a.deptnumb=b.dept GROUP BY a.deptname

54. Given the two following table definitions:


ORG
deptnumb INTEGER
deptname CHAR(30)
manager INTEGER
division CHAR(30)
location CHAR(30)
EMPLOYEE
id INTEGER
name CHAR(30)
dept INTEGER
job CHAR(20)
years INTEGER
salary DECIMAL(10,2)
comm. DECIMAL(10,2)
Which of the following statements will display each department, by name, and the total salary of
all
employees in the department?
A. SELECT a.deptname, SUM(b.salary) FROM org a, staff b WHERE a.deptnumb = b.dept ORDER
BY
a.deptname
B. SELECT b.deptname, SUM(a.salary) FROM org a, staff b WHERE a.deptnumb = b.dept ORDER
BY
a.deptname
C. SELECT a.deptname, SUM(b.salary) FROM org a, staff b WHERE a.deptnumb = b.dept GROUP
BY
a.deptname
D. SELECT b.deptname, SUM(a.salary) FROM org a, staff b WHERE a.deptnumb = b.dept GROUP
BY
a.deptname

55. With DBADM authority on the database and given the statements:
CREATE TABLE t1 (c1 CHAR(1))
INSERT INTO t1 VALUES (�b�)
CREATE VIEW v1 AS SELECT c1 FROM t1 WHERE c1=�a� WITH CHECK OPTION
INSERT INTO v1 VALUES(�a�)
INSERT INTO v1 VALUES(�b�)
How many rows would be returned from the statement, SELECT c1 FROM t1?
A. 0
B. 1
C. 2
D. 3

56. With DBADM authority on the database and given the statements:
CREATE TABLE t1 (c1 CHAR(1))
INSERT INTO t1 VALUES (�b�)
CREATE VIEW v1 AS SELECT c1 FROM t1 WHERE c1=�a�
INSERT INTO v1 VALUES(�a�)
INSERT INTO v1 VALUES(�b�)
How many rows would be returned from the statement, SELECT c1 FROM t1?
A. 0
B. 1
C. 2
D. 3

57.Assuming the proper privileges, which two of the following would allow access to data in a
table T1
using the name A1?
A.CREATE ALIAS a1 FOR t1
B.CREATE TABLE a1 LIKE t1
C.CREATE INDEX a1 ON t1 (col1)
D.CREATE VIEW a1 AS SELECT * FROM t1
E.CREATE TRIGGER trig1 AFTER INSERT ON t1 FOR EACH ROW MODE DB2SQL INSERT
INTO a1
58.Given the following statements:
CREATE TABLE t1
(c1 INTEGER,
c2 INTEGER,
c3 DECIMAL(15,0 ))
INSERT INTO t1 VALUES (1, 2, 3.0)
Which of the following will cause C1 to be decremented each time a row is deleted from the T2
table?
A. ALTER TABLE t1
ADD CHECK(t2)
c1 = c1 - 1
B. CREATE VIEW v1 (c1)
AS (SELECT COUNT(*) FROM t2)
C. ALTER TABLE t1
ADD FOREIGN KEY (c1)
REFERENCES t2
ON DELETE CASCADE
D. CREATE TRIGGER trig1
AFTER DELETE ON t2
FOR EACH ROW MODE DB2SQL
UPDATE t1 SET c1 = c1 – 1

59.Table T1 should only allow values of 1, 2, and 3 in column C1. Which of the following will
cause the
database manager to enforce this business requirement?
A. Delete trigger on T1
B.Check constraint on C1
C.Table level lock on T1
D.Update permission on C1

82.Table T1 has a column C1 char(3) that contains strings in upper and lower case letters.
Which of the
following queries will find all rows where C1 is the string 'ABC' in any case?
A. SELECT * FROM t1 WHERE c1 = 'ABC'
B. SELECT * FROM t1 WHERE UCASE(c1) = 'ABC'
C. SELECT * FROM t1 WHERE IGNORE_CASE(c1 = 'ABC')
D. SELECT * FROM t1 WHERE c1 = 'ABC' WITH OPTION CASE INSENSITIVE

91.Given the following SQL statements:


CREATE TABLE birthday1
(day INT CHECK(day BETWEEN 1 AND 31),
month INT CHECK(month BETWEEN 1 AND 6),
year INT)
CREATE TABLE birthday2
(day INT CHECK(day BETWEEN 1 AND 31),
month INT CHECK(month BETWEEN 7 AND 12),
year INT)
CREATE VIEW birthdays AS
SELECT * FROM birthday1
UNION ALL
SELECT * FROM birthday2
INSERT INTO birthday1 VALUES( 22,10, 1973)
INSERT INTO birthday1 VALUES( 40, 8, 1980)
INSERT INTO birthday1 VALUES( 8, 3, 1990)
INSERT INTO birthday1 VALUES( 22, 10, 1973)
INSERT INTO birthday1 VALUES( 3, 3, 1960)
What will be the result of the following SELECT statement?
SELECT COUNT(*) FROM birthdays
A. 0
B. 2
C. 3
D. 5

94.A stored procedure has been created with the following statement:
CREATE PROCEDURE P1(IN VAR1 VARCHAR(10), INOUT VAR2 VARCHAR(10), OUT
VAR3 INT)...
From the command line processor (CLP), which is the correct way to call this procedure?
A. Call P1(?,?,?)
B. Call P1("DB2",?,?)
C. Call P1("DB2","DB2",?)
D. Call P1('DB2','DB)
����

67.Given the following DDL statements,


CREATE TABLE tab1 (a INT, b INT, c INT)
CREATE VIEW v1 AS SELECT a, b, c FROM tab1
WHERE a > 250 WITH CHECK OPTION
Which of the following INSERT statements will fail?
A.INSERT INTO v1 VALUES (200, 2, 3)
B.INSERT INTO v1 VALUES (300, 2, 3)
C.INSERT INTO tab1 VALUES (350, 2, 3)
D.INSERT INTO tab1 VALUES (250, 2, 3)}

95. Given the following statements:


CREATE TABLE t1 (id INTEGER, CONSTRAINT chkid CHECK (id<100))
INSERT INTO t1 VALUES (100)
COMMIT
Which of the following occurs as a result of issuing the statements?
A. The row is inserted with ID having a NULL value.
B. The row is inserted with ID having a value of 100.
C. The row insertion with a value of 100 for ID is rejected.
D. The trigger called chkid is activated to validate the data.

96. Given the statement:


CREATE VIEW v1 AS SELECT c1 FROM t1
WHERE c1=’a’ WITH CHECK OPTION
Which of the following SQL statements will insert data into the table?
A. INSERT INTO v1 VALUES (a)
B. INSERT INTO v1 VALUES (b)
C. INSERT INTO v1 VALUES ( ‘b’ )
D. INSERT INTO v1 VALUES ( ‘a’ )
E. INSERT INTO v1 VALUES ( ‘ab’ )

17. Given the statements and operations:


“CREATE TABLE t1 (c1 CHAR(1) )”
six rows are inserted with values of : a, b, c, d, e, and f
“SET CONSTRAINTS FOR t1 OFF”
“ALTER TABLE t1 ADD CONSTRAINT con1 CHECK (C1=’A’) ”
“SET CONSTRAINTS FOR t1 IMMEDIATE CHECKED FOR EXCEPTION IN t1 USE
t1exp”
which of the following describes what happens to the rows with values of b, c, d, e, and f?
A. Deleted from T1 only
B. Deleted from T1 and written into the t1exp file
C. Deleted from T1 and inserted into the table t1exp
D. Deleted from T1 and written into the db2diag.log file
E. Deleted from T1 and inserted into the table syscat.checks

97. Given the statement:


CREATE TABLE t1 (c1 CHAR(1))
Data has been inserted into the table with rows of a, b, c, d, e, f.
Given the following command is issused:
ALTER TABLE t1 ADD CONSTRAINT con1 CHECK (c1=�a�)
Which of the following occurs?
A. Rows with c1 values of b, c, d, e, f are deleted
B. Rows with c1 values of b, c, d, e, f have c1 set to NULL
C. The ALTER command will fail as rows violate the constraint
D. The ALTER command will move the violating rows to the exception table

98. Given the statement:


CREATE TABLE t1
(c1 CHAR(#)
CONSTRAINT c1
CHECK (c1 IN (�A01�, �B01�, �C�))
)
DB2 verifies that the table check constraint is met during which of the following actions?
A. Adding data using load
B. The reorg of the table
C. The insert of each row in t1
D. The creation of the index for the table

99. In which of the following locations are referential constraints stored?


A. The user tables
B. The explain tables
C. SYSIBM.SYSTRIGGERS
D. The system catalog tables

100. If a table is defined with a check constraint for one or more columns, which of the following
will
perform the data validation after the table is loaded with the load utility?
A. Reorg
B. Check
C. Runstats
D. Image Copy
E. Set Constraints

101. Which of the following DELETE RULES on CREATE TABLE will delete a dependent
table row if the
parent table row is deleted?
A. ON DELETE REMOVE
B. ONDELETE CASCADE
C. ON DELETE RESTRICT
D. ON DELETE SET NULL
E. ON DELETE PROPAGATE

102. A table has had check constraint enforcement turned off, and additional data has been
inserted. Which
of the following will perform data validation to ensure that column values are valid?
A. Add a trigger
B. Collect statistics
C. Reorganize the table
D. Enable check constraints

103. When constraint checking is suspended or disabled, a table or table space (depending on
platform) is
placed in which of the following states?
A. Paused
B. Check pending
C. Intent locked
D. Constraint waiting
��

104.When granted to USER1, which of the following will allow USER1 to ONLY access table
data?
A. Administrative authority
B. SELECT privilege on the table
C. REFERENCES privilege on the table
D. SELECT privilege WITH GRANT OPTION on the table

118. When granted to user1, which of the following will allow user1 to ONLY access table data?
A. DBADM authority
B. SYSADM authority
C. SELECT privilege on the table
D. SELECT privilege WITH GRANT OPTION on the table

105. Given the following users and groups with no privileges on table t1:
GroupA GroupB
------ ------
user1 user4
user2 user5
user3
Which of the following commands gives all users in the above groups the ability to create a view
on table t1?
A. GRANT SELECT ON TABLE t1 TO ALL
B. GRANT SELECT ON TABLE t1 TO PUBLIC
C. GRANT REFERENCES ON TABLE t1 TO ALL
D. GRANT SELECT ON TABLE t1 TO USER GroupA, GroupB

106. A table called EMPLOYEE has the following columns:


NAME
DEPARTMENT
PHONE_NUMBER
Which of the following will allow USER1 to modify the PHONE_NUMBER column?
A. GRANT INDEX (phone_number) ON TABLE employee TO user1
B. GRANT ALTER (phone_number) ON TABLE employee TO user1
C. GRANT UPDATE (phone_number) ON TABLE employee TO user1
D. GRANT REFERENCES (phone_number) ON TABLE employee TO user1

107. USER3 is running a program A.APP1 that calls stored procedure P.PROC1.
As an administrator, which of the following statements should be executed to give USER3 the
appropriate
privilege to be able to execute the code found in stored procedure P.PROC1?
A. GRANT EXECUTE ON PACKAGE a.app1 TO user3
B. GRANT EXECUTE ON PROCEDURE a.app1 TO user3
C. GRANT EXECUTE ON FUNCTION p.proc1 TO user3
D. GRANT EXECUTE ON PROCEDURE p.proc1 TO user3

108. An administrator issues:


GRANT ALL PRIVILEGES ON TABLE appl.tab1 TO user1 WITH GRANT OPTION
Which of the following statements is USER1 authorized to execute?
A. GRANT DROP ON TABLE appl.tab1 TO user8
B. GRANT OWNER ON TABLE appl.tab1 TO user8
C. GRANT INSERT ON TABLE appl.tab1 TO user8
D. GRANT CONTROL ON TABLE appl.tab1 TO user8

109. A user defined function named F.FOO has an input parameter of an integer.
USER4 executes the f ollowing SQL statement:
SELECT col1, col2 FROM t.tab1 WHERE f.foo(col1) < 6;
Which of the following statements grants USER4 the privilege needed to be able
to execute the user defined function?
A. GRANT USE ON FUNCTION f.foo(INT) TO user4
B. GRANT SELECT ON FUNCTION f.foo(INT) TO user4
C. GRANT EXECUTE ON FUNCTION f.foo(INT) TO user4
D. GRANT REFERENCES ON FUNCTION f.foo(INT) TO user4

110 Given a user defined function, U.UDF1, that takes an input parameter of type
INTEGER, and USER6 running the following SQL statement:
SELECT w.udf1(col6) FROM t.tab1 WHERE col4 = 'ABC'
Which of the following statement(s) would allow USER6 to execute the statement?
A. GRANT ALL PRIVILEGES ON TABLE t.tab1 TO user6
B. GRANT SELECT ON TABLE t.tab1 TO user6
C. GRANT SELECT ON TABLE t.tab1 TO user6
GRANT REFERENCES ON FUNCTION u.udf1( INT) TO user6
D. GRANT ALL PRIVILEGES ON TABLE t.tab1 TO user6
GRANT EXECUTE ON FUNCTION u.udf1(INT) TO user6

81.Given the following existing user defined functions:


GEN.FN1(INT,CHAR) RETURNS CHAR
GEN.FN1(INT) RETURNS INT
GEN.FN1(CHAR) RETURNS DOUBLE
USERA needs to execute GEN.FN1(INT,CHAR) RETURNS CHAR.
Which of the following statements successfully grants the required privilege?
A.GRANT EXECUTE ON FUNCTION gen.fn1 TO usera
B.GRANT EXECUTE ON FUNCTION gen.fn1(INT,CHAR) TO usera
C.GRANT EXECUTE ON FUNCTION gen.fn1 RETURNS CHAR TO usera
D.GRANT EXECUTE ON FUNCTION gen.fn1(INT,CHAR) RETURNS CHAR TO usera
111. Which of the following will grant just DML operations on table T.T4 to all users?
A. GRANT ALL PRIVILEGES ON t.t4 TO PUBLIC
B. GRANT ALL PRIVILEGES ON t.t4 TO ALL USERS
C. GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE t.t4 to PUBLIC
D. GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE t.t4 TO ALL USERS

112. Which of the following will give USER6 the ability to give SELECT privilege on table T.T1
to other
users?
A. GRANT SELECT ON TABLE t.t1 TO user6
B. GRANT ALL PRIVILEGES ON TABLE t.t1 TO user6
C. GRANT USE ON TABLE t.t1 TO user6 WITH GRANT OPTION
D. GRANT ALL PRIVILEGES ON TABLE t.t1 TO user6 WITH GRANT OPTION

113. Which of the following delete rules will not allow a row to be deleted from the parent table
if a row
with the corresponding key value still exists in the child table?
A. DELETE
B. CASCADE
C. RESTRICT
D. SET NULL

114. Given the following table definition and SQL statements:


CREAT TABLE table1 (col1 INT, col2 CHAR(40), col3 INT)
GRANT INSERT,UPDATE,SELECT,REFERENCES ON TABLE table1 TO USER usera
Which of the following SQLstatements will revoke privileges for user USERA on COL1 and
COL2?
A. REVOKE UPDATE ON TABLE table1 FROM USER usera
B. REVOKE ALL PRIVILEGES ON TABLE table1 FROM USER usera
C. REVOKE ALL PRIVILEGES ON TABLE table1 COLUMNS(col1,col2) FROM USERA
D. REVOKE REFERENCES ON TABLE table1 COLUMNS(col1,col2) FROM USER usera

115.What does the following statement do?


GRANT REFERENCES(col1) ON TABLE t.t1 TO user7
A. Gives USER7 the ability to refer to column COL1 of table T.T1 in views or select statements
B. Gives USER7 the ability to refer to column COL1 of table T.T1 on user-defined function calls
C. Gives USER7 the ability to define referential integrity on table T.T1 using column COL1 as the
parent key
D. Gives USER7 the ability to define referential integrity on table T.T1 using column COL1 as the
foreign
Key

116. Which of the following SQL statements sets the default qualifier to �user1�?
A. SET CURRENT ID =�user1�
B. SET CURRENT USER=�user1�
C. SET CURRENT SQLID=�user1�
D. SET CURRENT QUALIFIER=�user1�

117. The user USER1 is executing the statement:


CREATE TABLE app1.table1(col1 INT, col2 INT)
Which of the following privileges is required by USER1 for the statement to be successful?
A. CREATE for the database
B. CREATE for the schema app1
C. CREATE for the schema user1
D. CREATE for the table table1

119. A user creates the table TABLE1. Which of the following statements would explicitly give
USER1 the
ability to read rows from the table?
A. GRANT VIEW TO user1 ON TABLE table1
B. GRANT READ TO user1 ON TABLE table1
C. GRANT SELCET ON TABLE table1 TO user1
D. GRANT ACCESS ON TABLE table1 TO user1

120. Which of the following can occur once connected to a database or DRDA server with an
explicit
authorization name?
A. Omit a user’s password
B. Change a user’s password if the server supports this function
C. Omit the name of the database or DRDA server if it is local
D. Use the commit option on the connect statement to commit in-doubt units of work from a previous
connection that was terminated

121. When establishing client-server communication, passwords CANNOT be verified by:


A. The DRDA DB2 server
B. the client operating system
C. The gateway operating system
D. Looking in the catalog tables for the password
122. User2 has DBADM authority on database DB1. This allows the user to do which of the
following?
A. Drop database DB1
B. Backup database DB1
C. Create tables in any database
D. Create tables in database DB1
123. Which of the following is the most appropriate reason to consider revoking the SELECT
privilege on
the catalog tables from PUBLIC after creating a database?
A. To prevent users from creating tables without proper authority
B. Some system catalogs record user data in some columns, and this data may be confidential
C. To prevent users from viewing the passwords for other DB2 useid that DB2 stores in the catalog
tables
D. Some catalog tables are larger, so preventing users from viewing them is a good way to keep users
from
submitting long-running queries against the catalogs
124. Which of the following is the implicit qualifier for a declared temporary table?
A. The schema name SYSCAT
B. The schema name SESSION
C. The schema name TEMPUSER
D. The userid specified with the BIND command
E. The userid who established the connection to the database and declared the temporary table
125.Which of the following is possible once a user has been given maintenance authority?
A. DB2 userids can be created
B. Views can be created on the catalogs
C. Statistics can be collected for database objects
D. A table can be populated by using the LOAD command
126. Which of the following is the best way to restrict user access to a subset of columns in a
table?
A. Only grant access to the columns within a table that a user is allowed to see.
B. Create a view that only includes the columns a user is allowed to see. Grant the user access to the
view, not
the base table.
C. Create two tables: one with the columns that a user is allowed to see, and one that has the
confidential
columns, and use a join when all data must be presented.
D. Create two tables: one with the columns that a user is allowed to see, and one that has the
confidential
columns, and use a union when all data must be presented.
127. Which of the following privilege is necessary to populate the table with large amounts of
data?
A. LOAD
B. ALTER
C. UPDATE
D. IMPORT
128. A table called EMPLOYEE has columns: name, department, and phone_number. Which of
the
following can limit access to the phone_number column?
A. Using a view to access the table
B. Using an index on the column
C. Using a referential constraint on the table
D. Using a table check constraint on the table
129. Cataloging a remote database server from a Linux, UNIX, or Windows gateway is:
A. performed to identify the location of the clients.
B. performed to identify the server the DB2 database manager is on.
C. never performed in DB2, as only one database per node is allowed, so cataloging a node
automatically
catalogs the database at that node.
D. performed on a Linux, UNIX, or Windows machine to open the catalogs in the DB2 database
server and
present a user with a list of all accessible tables in that database.
130. Cataloging a remote database is:
A. Performed on a PC or UNIX machine to identify the server the DB2 database manager is on
B. Performed on a PC or UNIX machine to identify the DB2 database to user and application
C. Never performed in DB2, as only one database per node is allowed, so cataloging a node
automatically
catalogs the database at that node
D. Performed on a PC or UNIX machine to open the catalogs in the DB2 database and present a user
with a
list of all accessible tables in that database
131. The purpose of the USE privilege is to:
A. query data in a table
B. load data into a table
C. create tables within a table space
D. create table spaces within a database
132. Which of the following database authorities is required to create packages in a database?
A. BINDADD
B. CREATETAB
C. CREATEPKG
D. PACKAGEADD
133. Which two of the following authorities can create a database?
A. DBADM
B. SYSADM
C. DBCTRL
D. SYSCTRL
E. SYSMAINT
134. Which of the following authorities should be given to the DB2 Administration Server (DAS)
Instance
owner at the administered instance?
A. DBADM
B. SYSADM
C. SYSCTRL
D. SYSMAINT
135. Which two of the following DB2 authorization groups are authorized to create a table
within database
sample?
A. DBADM
B. DBCTRL
C. SYSADM
D. CBMAINT
E. ALTERIN
F. SYSMAINT
����
136. A user has a numeric data column with a maximum value of 100,000. Which of the
following data types
will buse the minimum amount of storage for the column?
A. IDENTITY
B. BIGINT
C. INTEGER
D. SMALLINT
74.A user wishes to store a numeric with a maximum value of 100,000. Which data type will
allow the user
to store these values while using the least amount of storage?
A. BIGINT
B. INTEGER
C. IDENTITY
D. SMALLINT
137. Given the following column requirements:
Col1 Numeric Identifier – From 1 to 1000000
Col2 Job Code – Variable, 1 to 2 characters long
Col1 Job Description –Variable, 1 to 100 characters long
Col1 Job Length – Length of Job in seconds
Which of the following will minimize the disk space allocated to store the records in Job
Description has an
average length of 45?
A. CREATE TABLE tab1 (col1 INT, col2 CHAR(2), col3 CHAR(100), col4 INT)
B. CREATE TABLE tab1 (col1 INT, col2 VARCHAR(2), col3 CHAR(100), col4 INT)
C. CREATE TABLE tab1 (col1 INT,col2 CHAR(2), col3 VARCHAR(100), col4 INT)
D. CREATE TABLE tab1 (col1 INT,col2 VARCHAR(2), col3 VARCHAR(100), col4 INT)
138. Which of the following DB2 data types is used to store 50MB of binary data as a single
value?
A. BLOB
B. CLOB
C. DBCLOB
D. FOR BIT DATA
E. VARCHAR FOR BIT DATA
139. Which two of the following SQL data types should be used to store binary data?
A. CLOB
B. BLOB
C. VARCHAR
D. GRAPHIC
E. VARCHAR FOR BIT DATA
140. Which of the following is NOT a valid data type on CREATE TABLE?
A. CLOB
B. DOUBLE
C. NUMERIC
D. DATETIME
141. Given the following scenario: An application uses a 15 digit value to uniquely identify
customer
transactions. This number is also used for arithmetic operations. Which of the following is the
most efficient
DB2 data type for the column definition for this purpose?
A. CHAR
B. CLOB
C. INTEGER
D. NUMERIC(15, 2)
E. DECIMAL(15, 0)
142. Given that table T1 needs to hold specific numeric values up to 99999.99 in column C1.
A. REAL
B. INTEGER
C. NUMERIC(7,2)
D. DECIMAL(5,2)
75.Which of the following DB2 data types CANNOT be used to contain the date an employee
was hired?
A. CLOB
B. TIME
C. VARCHAR
D. TIMESTAMP
76.Assuming the database has no distinct types, which of the following is an invalid data type on
CREATE
TABLE?
A.CLOB
B.DOUBLE
C.NUMERIC
D.DATETIME
��
143. For which of the following database objects can locks be obtained?
A. View
B. Table
C. Trigger
D. Buffer Pool
144. For which of the following database objects can locks NOT be obtained?
A. A row
B. A table
C. A column
D. An index key
145. Which of the following types of DB2 locks allows for the most concurrency within a table?
A. A row lock
B. A page lock
C. A field lock
D. A column lock
146. For which of the following can locks be obtained?
A. A trigger
B. A table view
C. A table column
D. A database buffer
E. A row referenced by an index key
147. Which of the following processing can occur for a unit of work using an isolation level of
Read Stability
and scanning through the table more than once within the unit of work?
A. Access uncommitted changes made by other processes
B. Update uncommitted changes made by other processes
C. Rows added to a result set by other processes from one scan to the next
D. Rows changed in a result set by other processes from one scan to the next
148. Which of the following processing can occur for a unit of work using an isolation level of
Cursor
Stability and allows scanning through the table more than once within the unit of work?
A. Access uncommitted changes made by other processes
B. Update uncommitted changes made by other processes
C. Have updated result set rows changed by other processes from one scan to the next
D. Have accessed result set rows changed by other processes from one scan to the next
149. Which of the following processing can occur for a unit of work using an isolation level of
Uncommitted
Read and scanning through the table more than once within the unit of work?
A. Access uncommitted changes made by other processes
B. Update uncommitted changes made by other processes
C. Rows added to a result set by other processes from one scan to the next
D. Rows changed in a result set by other processes from one scan to the next
150. An application using the Repeatable Read isolation level acquires an update lock. When
does the
update lock get released?
A. When the cursor accessing the row is closed
B. When the transaction issues a ROLLBACK statement
C. When the cursor accessing the row is moved to the next row
D. When the transaction changes are made via an UPDATE statement
151. An update lock gets released by an application using the repeated read isolation level
during which of
the following?
A. If the cursor accessing the row is closed
B. If the transaction issues a ROLLBACK statement
C. If the cursor accessing the row is moved to the next row
D. If the transaction changes are made via an UPDATE statement
152. An application is using the Cursor Stability isolation level. Which of the following releases a
row lock
acquired by this application?
A. When the cursor accessing the row is moved to the next row
B. When the cursor accessing the row is used to update the row
C. When the application's current row is deleted by the application
D. When the application's current row needs to be updated by another application
153. Which of the following releases a lock by an application using the cursor stability isolation
level?
A. If the cursor accessing the row is moved to the next row
B. If the cursor accessing the row is used to update the row
C. If the application’s current row is deleted by the application
D. If the application’s current row needs to be updated by another application
154. Which two of the following modes can be used on the lock table statement?
A. SHARE MODE
B. EXCLUSIVE MODE
C. REPEATABLE READ MODE
D. UNCOMMITTED READ MODE
E. INTENT EXCLUSIVE MODE
155. Which of the following DB2 UDB isolation levels will NOT lock any rows during read
processing?
A. Read stability
B. Repeatable read
C. Uncommited read
D. Cursor stability
156. Which of the following isolation levels will lock only the rows returned in the result set?
A. Read Stability
B. Repeatable Read
C. Cursor Stability
D. Uncommitted Read
157. Which of the following isolation levels is most likely to acquire a table level lock during an
index scan?
A. Read Stability
B. Repeatable Read
C. Cursor Stability
D. Uncommitted Read
79.Which of the following isolation levels most frequently acquires a table level lock during an
index scan?
A. Read Stability
B. Repeatable Read
C. Cursor Stability
D. Uncommitted Read
158. Given the following:
A table containing a list of all seats on an airplane. A seat consists of a seat number and whether
or not it is
assigned. An airline agent lists all the unassigned seats on the plane. When the agent refreshes
the list from
the table, the list should not change.
Which of the following isolation levels should be used for this application?
A. Read stability
B. Repeatable read
C. Cursor stability
D. Uncommited read
159. Given the following:
A table containing a list of all seats on an airplane. A seat consists of a seat number and whether
or not it is
assigned. An airline agent lists all the unassigned seats on the plane. When the agent refreshes
the list from
the table, the list should only change if another agent unassigens a currently assigned seat.
Which of the following isolation levels should be used for this application?
A. Read stability
B. Repeatable read
C. Cursor stability
D. Uncommited read
80.An embedded SQL application is bound with Cursor Stability isolation level. It issues a
request that
retrieves 20 rows out of 200000 in the table. Which of the following describes the locks that are
held as a
result of this request?
A. None of the rows are locked.
B. The retrieved rows are locked.
C. The last row accessed is locked.
D. The rows not previously updated by another application are locked.
160. Given a read-only application that requires consistent data for every query, which of the
following
isolation levels should it use to provide the most concurrency with other applications doing
updates?
A. Read Stability
B. Repeatable Read
C. Cursor Stability
D. Uncommitted Read
161. Given the requirement of providing a read-only database, applications accessing the
database should
be run which of the following isolation levels to allow for the most read concurrency?
A. Read Stability
B. Repeatable Read
C. Cursor Stability
D. Uncommitted Read
162. Given an application bound with cursor stability which will be updating rows in a table and
obtaining
row locks, which of the following table locks will DB2 acquire for the application first?
A. U – update
B. X – exclusive
C. IU – intent update
D. IX – intent exclusive
27. Given the following table with a primary key on empid:
EMP
Empid Name
11 Joe Smith
23 Melanie Jones
30 Robert Bruce
49 Janice Baker
66 Mario Diaz
68 Mario Diaton
Give the following statement in an embedded SQL program bound with Repeatable Read:
Select * from Emp where empid<55
How many rows in the table will be locked after the statement is run?
A. 0
B. 1
C. 4
D. 5
E. 6
��
61.Which two of the following results from a successful ROLLBACK statement?
A.The current unit of work is restarted.
B.Existing database connections are released.
C.Locks held by the current unit of work are released.
D.Tables in LOAD PENDING for the current unit of work are released.
E.Changes made by the current unit of work since the last COMMIT point are undone.
163. Which of the following is the result of a successful ROLLBACK statement?
A. Held locks are released
B. Release�pending conditions are undone
C. Tables in LOAD PENDING are releaded
D. Constraint checking conditions are undone
E. Existing database connections are released
165. Which of the following occurs if an application ends abnormally during an active unit of
work?
A. Current unit of work is commited.
B. Current unit of work is rolled back.
C. Current unit of work remaind active.
D. Current unit of work moves to pending state.
63.Which of the following occurs if an application ends abnormally during an active unit of
work?
A. The unit of work is committed
B. The unit of work is rolled back
C. The unit of work remains active
D. The unit of work moves to pending state
164. Which of the following does NOT end a unit of work?
A. COMMIT
B. ROLLBACK
C. TERMINATE
D. SAVEPOINT
E. CONNECT RESET
166. Which of the following describes why savepoints are NOT allowed inside an atomic unit of
work?
A. Atomic units of work span multiple databases, but savepoints are limited to units of work which
operate on
a single database.
B. A savepoint implies that a subset of the work may be allowed to succeed, which atomic operations
must
succeed or fail as a unit.
C. A savepoint requires an explicit commit to be released, and commit statements are not allowed in
atomic
operations such as compound SQL.
D. A savepoint cannot be created without an active connection to a database, but atomic operations
can
contain a CONNECT as a sub-statement.
167. Given an embedded SQL program with a single connection, two threads and the following
actions:
Thread1: INSERT INTO mytab VALUES(�)
Thread2: INSERT INTO mytab VALUES(�)
Thread1: ROLLBACK
Thread2: INSERT INTO mytab VALUES(�)
Thread1: COMMIT
How many records will be successfully inserted into the table mytab?
A. 0
B. 1
C. 2
D. 3
168 Given an embedded SQL program with a single connection, two threads and the following
actions:
Thread1: INSERT INTO mytab VALUES(�)
Thread2: INSERT INTO mytab VALUES(�)
Thread1: COMMIT
Thread2: INSERT INTO mytab VALUES(�)
Thread1: ROLLBACK
How many records will be successfully inserted into the table mytab?
A. 0
B. 1
C. 2
D. 3
169. Given the following embedded SQL programs:
Program1:
Create table mytab (col1 int, col2 char(24))
Commit
Program2:
Insert into mytab values (20989, �Joe Smith�)
Commit
Insert into mytab values (21334, �Amy Johnson�)
Delete from mytab
Commit
Insert into mytab values (23430, �Jason French�)
Rollback
Insert into mytab values (20993, �Samantha Jones�)
Commit
Delete from mytab where col1= 20993
Rollback
Which of the following records will be returned by the statement
SELECT * FROM mytab?
A. 20989, �Joe Smith
B. 21334, �Amy Johnson�
C. 23430, �Jason French�
D. 20993, �Samantha Jones�
E. No records are returned
62.Given the following statements from two embedded SQL programs:
Program 1:
CREATE TABLE mytab (col1 INT, col2 CHAR(24))
COMMIT
Program 2:
INSERT INTO mytab VALUES( 20989,'Joe Smith')
COMMIT
INSERT INTO mytab VALUES( 21334,'Amy Johnson')
DELETE FROM mytab
COMMIT
INSERT INTO mytab VALUES( 23430,'Jason French')
ROLLBACK
INSERT INTO mytab VALUES( 20993,'Samantha Jones')
COMMIT
DELETE FROM mytab WHERE col1=20993
ROLLBACK
Assuming Program 1 ran to completion and then Program 2 ran to completion, which of the
following
records would be returned by the statement:
SELECT * FROM mytab?
A.20989, Joe Smith
B.21334, Amy Johnson
C.23430, Jason French
D.20993, Samantha Jones
E.No records are returned.
170. Given the following embedded SQL programs:
Program1:
Create table mytab (col1 int, col2 char(24))
Commit
Program2:
Insert into mytab values (20989, �Joe Smith�)
Insert into mytab values (21334, �Amy Johnson�)
Commit
Delete from mytab
Rollback
Insert into mytab values (23430, �Jason French�)
Rollback
Insert into mytab values (20993, �Samantha Jones�)
Commit
Delete from mytab where col1= 20993
Rollback
Which of the following indicates the number of records that will be returned by the statement:
SELECT * FROM mytab?
A. 0
B. 1
C. 2
D. 3
E. 4
171. Given the table COUNTRY and the statements below:
COUNTRY
ID NAME PERSON_ID CITIES
1 Argentina 1 10
2 Canada 2 20
3 Cuba 2 10
4 Germany 1 0
5 France 7 5
DECLARE c1 CURSOR WITH HOLD FOR SELECT * FROM country ORDER BY
person_id, name
OPEN c1
FETCH c1
FETCH c1
COMMIT
FETCH c1
Which of the following is the last name obtained from the table?
A. Cuba
B. France
C. Canada
D. Germany
E. Argentina
172. Given the following transaction:
CREATE TABLE Dwaine.mytab (col1 INT, col2 INT)
INSERT INTO dwaine.mytab VALUES (1, 2)
INSERT INTO dwaine.mytab VALUES (3, 4)
ROLLBACK
Which of the following would be returned from the statement:
SELECT * FROM Dwaine.mytab?
A. COL1 COL2
��� ���
0 record(s) selected.
B. COL1 COL2
��� ���
12
1 record(s) selected.
C. SQLCODE � 204 indicating that �DWAINE.MYTAB�is an undefined name.
D. COL1 COL2
��� ���
12
34
2 record(s) selected.
173. Given successfully executed embedded SQL:
INSERT INTO staff VALUES (1, �Colbert�, �Dorchester�, 1)
COMMIT
INSERT INTO staff VALUES (6, �Anders�, �Cary�, 6)
INSERT INTO staff VALUES (3, �Gaylord�, �Geneva�, 8)
ROLLBACK
Which of the following indicates the number of new rows that would be in the STAFF table?
A. 0
B. 1
C. 2
D. 3
174. Given two embedded SQL program executions with the following actions:
Pgm1
INSERT INTO mytab VALUES(�)
COMMIT
INSERT INTO mytab VALUES(�)
ROLLBACK
Pgm2
INSERT INTO mytab VALUES(�)
ROLLBACK
INSERT INTO mytab VALUES(�)
COMMIT
How many records will be successfully inserted and retained in the table mytab?
A. 1
B. 2
C. 3
D. 4
175. Given two embedded SQL programs and the following actions:
Pgm1 Pgm2
INSERT INTO mytab VALUES(�) DELETE FROM mytab
COMMIT ROLLBACK
DELETE FROM mytab INSERT INTO mytab VALUES(�)
ROLLBACK COMMIT
If there exists one (1) row in table mytab before the programs are executed concurrently, how
many records
will be in the table once the programs complete?
A. 0
B. 1
C. 2
D. 3
E. 4
��
77.Where are referential constraint definitions stored?
A. The user tables
B. The explain tables
C. SYSIBM.SYSTRIGGERS
D. The system catalog tables
176. When establishing client-server communication, which two of the following can be used to
verify
passwords?
A. Catalog Tables
B. Access Control List
C. Application Programs
D. DRDA Application Server
E. Client Operating System
responses = 2
177. A declared temporary table is used for which of the following purposes:
A. Backup purposes
B. Storing intermediate results
C. Staging area foe the load utility
D. Sharing result sets between applications
178. For a clustering index to be effective in keeping the data in order, which if the following
parameters
must be set correctly for the index?
A. FREE ROWS
B. PERCENT FREE
C. CLUSTER RATIO
D. CLUSTER FACTOR
179. Which of the following CANNOT be used to restrict specific values from being inserted into
a column
in a particular table?
A. view
B. index
C. check constraint
D. referential constraint
180. Which of the following describes when indexes can be explicitly referenced by name within
an SQL
statement?
A. When dropping the index
B. When updating the index
C. When selecting on the index
D. When inserting using the index
78.Which of the following actions describes when SQL indexes can be explicitly referenced by
name within
an SQL statement?
A. When dropping the index.
B. When altering the index.
C. When selecting on the index.
D. When inserting using the index.
181. The DB2 Administration Server (DAS) is required for which of the following?
A. For the administrator user id to install or remove DB2
B. For the remote clients to use the control Cinter against the instance
C. For checking authorities in the database manager configuration for SYSADM
D. For maintaining authorities added and removed by the SQL GRANT and REVOKE commands
respectively
182. Which of the following Control Center options shows the dependencies between a specific
view and its
tables?
A. Show SQL
B. Show Related
C. Sample Contents
D. Customized Columns
183. Which of the following Control Center features can be used to update information for the
optimizer to
choose the best path to data?
A. Show Related
B. Generate DDL
C. Run Statistics
D. Reorganize Table
184. To set up a client that can access DB2 UDB through DB2 Connect Enterprise Edition,
which of the following is the minimum sof tware client that must be installed?
A. DB2 Runtime Client
B. DB2 Personal Edition
C. DB2 Administration Client
D. DB2 Application Development Client
185. Which of the following tools is used to create and build stored procedures?
A. SQL Assist
B. Task Center
C. Development Center
D. Replication Center
186. Which of the f ollowing tools is used to create subscription sets and add
subscription-set members to subscription sets?
A. Journal
B. License Center
C. Replication Center
D. Development Center
187 Which of the following tools is used to develop and deploy stored procedures?
A. Task Center
B. Control Center
C. Command Center
D. Development Center
188. Which of the following must be set up to allow the Control Center to view database objects?
A. ODBC
B. JAVA
C. DB2 Administration Server
D. Client Configuration Assistant
189. A view is used instead of a table for users to do which of the following?
A. Avoid allocating more disk space per database
B. Provide users with the ability to define indexes
C. Restrict user’s access to a subnet of the table data
D. Avoid allocating frequently used query result tables
190. Why is a unique index not sufficient for creation of a primary key?
A. It id dufficient – a primary key is the same thing as a unique index
B. Unique indexes can be defined in ascending or descending order. Primary keys must be ascending.
C. A unique index can be defined over a column or columns that allow nulls. Primary keys cannot
contain
nulls.
D. A unique insex can be defined over a xolumn or columns tha t allow nulls. This is not allowed for
primary
keys because foreign keys cannot contain nulls.
191. Which of the following products can be used to perform a dictionary-based search?
A. Net.Data
B. XML Extender
C. AVI Extender
D. Text Extender
192. Which of the following extenders allows data to be presented in a three-dimensional
format?
A. DB2 AVI Extender
B. DB2 XML Extender
C. DB2 Text Extender
D. DB2 Spatial Extender
193. Which of the following products can be used to perform a dictionary-based
search?
A. Net.Data
B. XML Extender
C. AVI Extender
D. Text Extender
194. Which of the following products can be used to generate Extensible Markup Language
documents
from DB2 tables?
A. Net.Data
B. XML Extender
C. AVI Extender
D. Text Extender
195. Which of the following products can be used to store image data in a DB2 database?
A.Net.Data
B. Net Search
C. DB2 AVI Extender
D. DB2 XML Extender
E. DB2 Text Extender
196. Which two of the following types of storage management method is supported by DB2
OLAP Server?
A. Object
B. Network
C. Relational
D. Hierarchical
E. Multi-dimensional
197. Which of the following is used to build and manage a heterogeneous Data Warehouse
environment?
A. DataJoiner
B. Control Center
C. Workload Manager
D. DB2 Warehouse Manager
198. Which of the following products is designed f or analyzing data with more than two
dimensions?
A. DB2 OLAP Server
B. DB2 Warehouse Manager
C. DB2 Relational Connect
D. DB2 Data Links Manage
199. Which of the following DB2 components allows the analysis of multidimensional database?
A. DB2 Runtime Client
B. DB2 Control Center
C. DB2 OLAP Starter Kit
D. DB2 Spetial Extender
E. DB2 Performance Monitor
200. If a DB2 Warehouse Manager toolkit selected during the installation of DB2 UDB Version
7.1 , which
of the following databases must be defined?
A. None
B. Target Database
C. Source Database
D. Control Database
201. Which of the following tools can be used to identify inefficient SQL statements without
executing the
query?
A. QMF
B. Script Center
C. Visual Explain
D. Performance Monitor
202. Which of the following tools allows the DBA to set limits, and be alerted if these limits are
exceeded?
A. DB2 Index Winzard
B. DB2 Script Center
C. DB2 Command Center
D. DB2 Performance Monitor
203. Which of the following utilities can examine a table and its indexes and update the system
catalogs
with the table’s statistical information?
A. runstats
B. getstats
C. check index
D. chkstats
204. To set up a client that can access DB2 UDP through DB2 Connect Enterprise Edition,
which of the
following is the minimum software client that must be installed?
A. DB2 Runtime Client
B. DB2 Personal Edition
C. DB2 Adiministration Client
D. DB2 Application Developer’s Client
205. Which of the following products must be installed to provide a single point of control for
local and
remote DB2 database?
A. DB2 Runtime Client
B. DB2 Adiministration Client
C. DB2 Connect Enterprise Edition
D. DB2 Enterprise-Extended Edition
206. Which of the following will rebuild a package in the database from the existing catalog
information?
A. bind
B. rebind
C. update
D. rebuild
207. Which of the following tools maintains a history of all executed statements/commands for
the current
session within the tool?
A. Journal
B. SQL Assist
C. DB2 Alert Center
D. DB2 Command Center
208. Which of the following DB2 CLP options specify the file that contains the statements to be
executed?
A. -f
B. -b
C. -o
D. -w
209. When manually establishing communications from a Window NT client through a DB2
Connect
gateway to DB2 UDF for OS/390, which of the following is NOT required to catalog?
A. The client
B. The database on the DRDA server
C. The Database Connection Service database
D. The node where the DB2 Connect Gateway is
210. Using the Control Center Create Table dialog box, which of the following dialogs allows the
table
creation DDL to be viewed?
A. Copy
B. Show SQL
C. Show Related
D. Sample Contents
211. Which of the following can be used to determine the views that are affected by a DROP
TABLE
statement?
A. DB2 Script Center
B. DB2 Performance Monitor
C. DB2 Control Center, Show Related
D. DB2 Control Center, Sample Contents
212.Communications is being manually established from a Windows 2000 client through a DB2
Connect
gateway to a DB2 host system. Which of the following does NOT have to be cataloged on the
gateway?
A. The client
B. The node where the data source resides
C. The data source on the DB2 database server
D. The Database Connection Service (DCS) database
213.USER1 indicates that when running the following command from their client:
DB2 CONNECT TO sample USER user1
They receive the following error message:
SQL1013N The database alias name or database name "SAMPLE" could not be found.
SQLSTATE=42705
Assuming a valid password was entered when prompted, which of the following is the cause of
the
error?
A. SAMPLE is not listening for incoming connections from clients.
B. The DB2 client version is not compatible with the server version.
C. The client's database directory does not contain an entry SAMPLE.
D. The client's node directory has an entry in it that points at a non-existent server.
214. How many DB2 Administration Server (DAS) Instance can be set up per physical machine?
A. 0
B. 1
C. One for each instance on the physical machine
D. One for each database on the physical machine
215.A database administrator has supplied the following information:
• Protocol: TCP/IP
• Port Number: 446
• Host Name: ZEUS
• Database Name: SAMPLE
• Database Server Platform: OS/400
Which are the appropriate commands to set up the ability to connect to the database?
A. CATALOG TCPIP NODE zeus REMOTE zeus SERVER 446 OSTYPE os400 DATABASE
sample;
B. CATALOG TCPIP DATABASE sample REMOTE zeus SERVER 446 OSTYPE os400;
CATALOG DATABASE dcssam AS sample AT NODE zeus AUTHENTICATION dcs;
C. CATALOG TCPIP NODE zeus REMOTE zeus SERVER 446 OSTYPE os400;
CATALOG DCS DB dcssam AS sample;
CATALOG DATABASE dcssam AS sample AT NODE zeus AUTHENTICATION dcs;
D. CATALOG TCPIP NODE sample REMOTE sample SERVER 446 OSTYPE os400;
CATALOG DCS DB sample AS dcssam;
CATALOG DATABASE dcssam AS sample AT NODE zeus AUTHENTICATION dcs;
216.To catalog a TCP/IP database connection to a remote DB2 server which of the following
pieces of
information is needed?
A. Hostname
B. Password
C. Authorization-id
D. Operating system version
217. A client application on OS/390 must access a DB2 server on Unix, Windows, or OS/2. At a
minimum,
which of the following products is required to be on the DB2 server?
A. DB2 Connect Enterprise Edition
B. DB2 UDB Enterprise Server Edition
C. DB2 Connect Enterprise Edition and DB2 UDB Workgroup Server Edition
D. DB2 Connect Enterprise Edition and DB2 UDB Enterprise Server Edition
218. When using DB2 Connect, which of the following commands specifies the protocol
information on how
to connect to the host or to the server?
A. CATALOG DCS
B. CATALOG NODE
C. CATALOG DATABASE
D. CATALOG ODBC DATA SOURCE
219. A stored procedure has been built and deployed on the DB2 UDB server machine. What is
the
minimum software that must be installed to allow an application on the client to execute the
stored
procedure?
A. DB2 Runtime Client
B. DB2 Personal Edition
C. DB2 Administration Client
D. DB2 Application Development Client
220. Which of the following tools can be used to catalog a database?
A. Journal
B. Task Center
C. License Center
D. Configuration Assistant
221. SQL source statements for which two of the following are stored in the system catalog?
A. Views
B. Tables
C. Indexes
D. Triggers
E. Constraints
222. A client application on OS/390 or OS/400 must access a DB2 server on Linux. At a
minimum, which of
the following products is required to be on the DB2 server?
A. DB2 Connect Enterprise Edition
B. DB2 UDB Enterprise Server Edition
C. DB2 Connect Enterprise Edition and DB2 UDB Workgroup Server Edition
D. DB2 Connect Enterprise Edition and DB2 UDB Enterprise Server Edition
223. Which of the following has an object tree from which you can perform administrative tasks
against
database objects?
A. Control Center
B. Command Center
C. Command Line Processor
D. DB2 Administration Client
224. A client application on OS/390 or OS/400 must access a DB2 server on AIX.
At a minimum, which of the following products is required to provide DRDA
Application Server functionality on the DB2 server?
A. DB2 Connect Enterprise Edition
B. DB2 UDB Workgroup Server Edition
C. DB2 Connect Enterprise Edition and DB2 UDB Workgroup Server Edition
D. DB2 Connect Enterprise Edition and DB2 UDB Enterprise Server Edition
225. A developer is building an embedded SQL application on AIX that will access DB2 UDB
for OS/390 or
OS/400 servers.
Which of the following products is required to be installed on the AIX system in order to build
the
application?
A. DB2 Connect Personal Edition
B. DB2 Personal Developer's Edition
C. DB2 UDB Workgroup Server Edition
D. DB2 Universal Developer's Edition
226. A developer is building a Solaris application that will access DB2 UDB for OS/390 or
OS/400
servers. Which of the following products is required to be installed on the Solaris system in
order to build the application?
A. DB2 Connect Personal Edition
B. DB2 Personal Developer's Edition
C. DB2 UDB Workgroup Server Edition
D. DB2 Universal Developer's Edition
180. A developer is building an embedded SQL application on AIX that will access DB2
UDB for OS/390 or OS/400 servers.
Which of the following products is required to be installed on the AIX system in
order to build the application?
A. DB2 Connect Personal Edition
B. DB2 Personal Developer's Edition
C. DB2 UDB Workgroup Server Edition
D. DB2 Universal Developer's Edition
227. Which of the following products is required to be installed in order to build the application
on the AIX
that will access a DB2 UDB for OS/390 database?
A. DB2 Connect Personal Edition
B. DB2 Personal Developer's Edition
C. DB2 Universal Developer's Edition
D. DB2 UDB Workgroup Edition
228. Which of the following utilities would you run to order data and reclaim space from deleted
rows in a
table:
A. reorg
B. db2look
C. db2move
D. runstats
229. Which of the following processes is NOT performed by DB2 Warehouse Manager?
A. Query
B. Loading
C. Extraction
D. Transformation
230. Which of the following DB2 components allows reference to Oracle and DB2 databases in a
single
query?
A. DB2 Query Patroller
B. DB2 Warehouse Manager
C. DB2 Relational Connect
D. DB2 Connect Enerprise Edition

Potrebbero piacerti anche