Given the following two tables: TAB1 ---------------------- COL_1 COL_2 ----- ----- A 10 B 12 C 14 TAB2 ---------------------- COL_A COL_B ----- ----- A 21 C 23 D 25 Assuming the following results are desired: COL_1 COL_2 COL_A COL_B A 10 A 21 B 12 - - C 14 C 23 - - D 25 Which of the following joins will produce the desired results?
-
A
SELECT * FROM tab1 INNER JOIN tab2 ON col_1 =col_a
-
B
SELECT * FROM tab1 LEFT OUTER JOIN tab2 ON col_1 =col_a
-
C
SELECT * FROM tab1 RIGHT OUTER JOIN tab2 ON col_1 =col_a
-
D
SELECT * FROM tab1 FULL OUTER JOIN tab2 ON col_1 =col_a
Reveal answer details
Close answer details
A table named DEPARTMENT has the following columns: DEPT_ID DEPT_NAME MANAGER AVG_SALARY Which of the following is the best way to prevent most users from viewing AVG_SALARY data?
-
A
-
B
Create a view that does not contain the AVG_SALARY column
-
C
Revoke SELECT access for the AVG_SALARY column from users who should not see AVG_SALARY data
-
D
Store AVG_SALARY data in a separate table and grant SELECT privilege for that table to the appropriate users
Reveal answer details
Close answer details
Given the following CREATE TABLE statement: CREATE TABLE customer(custid INTEGER, info XML) And the following INSERT statements: INSERT INTO customer VALUES (1000, '<customerinfo xmlns="http://custrecord.dat" custid="1000"> <name>John Doe</name> <addr country="United States"> <street>25 East Creek Drive</street> <city>Raleigh</city> <state-prov>North Carolina</state-prov> <zip-pcode>27603</zip-pcode> </addr> <phone type="work">919-555-1212</phone> <email>[email protected]</email> </customerinfo>'); INSERT INTO customer VALUES (1000,
'<customerinfo xmlns="http://custrecord.dat" custid="1001"> <name>Paul Smith</name>
<addr country="Canada">
<street>412 Stewart Drive</street>
<city>Toronto</city>
<state-prov>Ontario</state-prov>
<zip-pcode>M8X-3T6</zip-pcode>
</addr>
<phone type="work">919-555-4444</phone>
<email>[email protected]</email>
</customerinfo>'); What is the result of the following XQuery expression? XQUERY declare default element namespace "http://custrecord.dat"; for $info in db2-fn:xmlcolumn ('CUSTOMER.INFO')/customerinfo where $info/addr/state-prov="Ontario" return $info/name/text();
-
A
-
B
<namexmlns="http://custrecord.dat">Paul Smith</name>
-
C
<customerinfo xmlns="http://custrecord.dat" custid="1001"><name xmlns="http://custrecord.dat">PaulSmith</name>
-
D
<customerinfo xmlns="http://custrecord.dat" custid="1001">Paul Smith</customerinfo>
Reveal answer details
Close answer details
Which of the following is a valid DB2 data type?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Which of the following tools can be used to schedule a backup operation that is to be run every Sunday evening?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
A transaction using the Read Stability isolation level scans the same table multiple times before it terminates. Which of the following can occur within this transaction's processing?
-
A
Uncommitted changes made by other transactions can be seen from one scan to the next.
-
B
Rows removed by other transactions that appeared in one scan will no longer appear in subsequent scans.
-
C
Rows added by other transactions that did not appear in one scan can be seen in subsequent scans.
-
D
Rows that have been updated can be changed by other transactions from one scan to the next.
Reveal answer details
Close answer details
Given the following set of statements: CREATE TABLE tab1 (col1 INTEGER, col2 CHAR(20));
COMMIT;
INSERT INTO tab1 VALUES (123, 'Red');
INSERT INTO tab1 VALUES (456, 'Yellow');
SAVEPOINT s1 ON ROLLBACK RETAIN CURSORS;
DELETE FROM tab1 WHERE col1 = 123;
INSERT INTO tab1 VALUES (789, 'Blue');
ROLLBACK TO SAVEPOINT s1;
INSERT INTO tab1 VALUES (789, 'Green');
UPDATE tab1 SET col2 = NULL WHERE col1 = 789;
COMMIT; Which of the following records would be returned by the following statement? SELECT * FROM tab1
-
A
COL1 COL2 ---- ------- 123 Red 456 Yellow 2 record(s) selected.
-
B
COL1 COL2 ---- ------ 456 Yellow 1 record(s) selected.
-
C
COL1 COL2 ---- ----- 123 Red 456 Yellow 3 record(s) selected.
-
D
COL1 COL2 ---- ------ 123 Red 456 Yellow 789 Green 3 record(s) selected.
Reveal answer details
Close answer details
Given the following statements: CREATE TABLE tab1 (col1 INT); CREATE TABLE tab2 (col1 INT); CREATE TRIGGER trig1 AFTER UPDATE ON tab1 REFERENCING NEW AS new1 FOR EACH ROW MODE DB2SQL INSERT INTO tab2 VALUES(new1.col1); INSERT INTO tab1 VALUES(2),(3); What is the result of the following query? SELECT count(*) FROM tab2;
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Which of the following products must be installed on an AIX server in order to build an application for AIX that will access a DB2 for z/OS database?
-
A
DB2Enterprise Server Edition
-
B
DB2 Personal Developer's Edition
-
C
DB2 Universal Developer's Edition
-
D
DB2 Universal DatabaseEnterprise Edition and DB2 Connect Enterprise Edition
Reveal answer details
Close answer details
Question 10
Single choice
Which of the following DB2 data types does NOT have a fixed length?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Question 11
Single choice
If the following statement is executed: CREATE TABLE employee
(empid INT NOT NULL GENERATED BY DEFAULT
AS IDENTITY (START WITH 1, INCREMENT BY 5),
name VARCHAR(20),
dept INT CHECK (dept BETWEEN 1 AND 20),
hiredate DATE WITH DEFAULT CURRENT DATE,
salary DECIMAL(7,2),
PRIMARY KEY(empid),
CONSTRAINT cst1 CHECK (YEAR(hiredate) > 2006 OR
Salary > 60500)); Which of the following INSERT statements will fail?
-
A
INSERT INTO employee VALUES (15, 'Smith', 5, '01/22/2004', 92500.00)
-
B
INSERT INTO employee VALUES (DEFAULT, 'Smith', 2, '10/07/2002', 80250.00)
-
C
INSERT INTO employee VALUES (20, 'Smith', 5, NULL, 65000.00)
-
D
INSERT INTO employee VALUES (DEFAULT, 'Smith', 10, '11/18/2004', 60250.00)
Reveal answer details
Close answer details
Question 12
Single choice
After the following SQL statement is executed: GRANT ALL PRIVILEGES ON TABLE employee TO USER user1 Assuming user USER1 has no other authorities or privileges, which of the following actions is user USER1 allowed to perform?
-
A
Drop an index on the EMPLOYEE table
-
B
Grant all privileges on the EMPLOYEE table to other users
-
C
Alter the table definition
-
D
Reveal answer details
Close answer details
Question 13
Multiple choice
Which two of the following allow you to perform administrative tasks against database objects?
-
A
-
B
-
C
-
D
-
E
Reveal answer details
Close answer details
Question 14
Single choice
Which of the following resources can be explicitly locked?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Question 15
Single choice
How should the following UDF be invoked in order to convert US currency values stored in the EXPENSES table into Canadian currency? CREATE FUNCTION getratews11 ( country1 VARCHAR(100), country2 VARCHAR(100) ) RETURNS DOUBLE LANGUAGE SQL CONTAINS SQL EXTERNAL ACTION NOT DETERMINISTIC BEGIN ... END
-
A
CALLgetratews11('USA','CANADA')
-
B
CALLexpenses.getratews11('USA','CANADA')
-
C
SELECTgetratews11('USA','CANADA') FROM expenses
-
D
SELECT * FROMTABLE(getratews11('USA','CANADA')) AS convert_currency
Reveal answer details
Close answer details
Question 16
Single choice
Which of the following is a typical data warehouse query?
-
A
What is this customer's address?
-
B
Does this customer have any unpaid bills?
-
C
What is the balance in this customers account?
-
D
What are the total sales for each of the last 6 months?
Reveal answer details
Close answer details
Question 17
Single choice
Which of the following is the best statement to use to create a user-defined data type that can be used to store currency values?
-
A
CREATE DISTINCT TYPE currency ASNUMERIC(7,2)
-
B
CREATE DISTINCT TYPE currency AS SMALLINT
-
C
CREATE DISTINCT TYPE currency AS BIGINT
-
D
CREATE DISTINCT TYPE currency AS DOUBLE
Reveal answer details
Close answer details
Question 18
Single choice
Application A holds a lock on a row in table TAB1. If lock timeout is set to 20, what will happen when Application B attempts to acquire a compatible lock on the same row?
-
A
Application B will acquire the lock it needs
-
B
Application A will be rolled back if it still holds its lock after 20 seconds have elapsed
-
C
Application B will be rolled back if Application A still holds its lock after 20 seconds have elapsed
-
D
Both applications will be rolled back if Application A still holds its lock after 20 seconds have elapsed
Reveal answer details
Close answer details
Question 19
Single choice
What does the following statement do? GRANT REFERENCES (col1, col2) ON TABLE table1 TO user1 WITH GRANT OPTION
-
A
Gives user USER1 the ability to refer to COL1 and COL2 of table TABLE1 in queries, along with the ability to give this authority to other users and groups.
-
B
Gives user USER1 the ability to refer to COL1 and COL2 of table TABLE1 in views, along with the ability to give this authority to other users and groups.
-
C
Gives user USER1 the ability to define a referential constraint on table TABLE1 using columns COL1 and COL2 as the parent key of the constraint.
-
D
Gives user USER1 the ability to define a referential constraint on table TABLE1 using columns COL1 and COL2 as the foreign key of the constraint.
Reveal answer details
Close answer details
Question 20
Single choice
Given the following two tables: TAB1 R1 -- A A A B B C C D E TAB2 R2 -- A A B B C C D Which of the following queries returns the following result set? RETVAL ------E
-
A
SELECT r1 ASretval FROM tab1 INTERSECT SELECT r2 AS retval FROM tab2
-
B
SELECT r1 ASretval FROM tab1 EXCEPT SELECT r2 AS retval FROM tab2
-
C
SELECT DISTINCT r1 ASretval FROM tab1, tab2 WHERE r1 <> r2
-
D
SELECT r1 ASretval FROM tab1 UNION SELECT r2 AS retval FROM tab2
Reveal answer details
Close answer details
Question 21
Single choice
Given the following DDL and INSERT statements: CREATE VIEW v1 AS SELECT col1 FROM t1 WHERE col1 > 10; CREATE VIEW v2 AS SELECT col1 FROM v1 WITH CASCADED CHECK OPTION; CREATE VIEW v3 AS SELECT col1 FROM v2 WHERE col1 < 100; INSERT INTO v1 VALUES(5); INSERT INTO v2 VALUES(5); INSERT INTO v3 VALUES(20); INSERT INTO v3 VALUES(100); How many of these INSERT statements will be successful?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Question 22
Single choice
Which of the following statements allows BOB to revoke access to the SAMPLE database from user TOM?
-
A
REVOKE ACCESS ON DATABASE FROM USER bob
-
B
REVOKE CONNECT ON DATABASE FROM USER tom
-
C
REVOKE tom FROM ACCESS ON DATABASE BY USER bob
-
D
REVOKE tom FROM CONNECT ON DATABASE BY USER bob
Reveal answer details
Close answer details
Question 23
Single choice
If the following SQL statements are executed: CREATE TABLE make (makeid SMALLINT NOT NULL PRIMARY KEY, make VARCHAR(25)); CREATE TABLE model (modelid SMALLINT, model VARCHAR(25), makeid SMALLINT, CONSTRAINT const1 FOREIGN KEY (makeid) REFERENCES make(makeid) ON DELETE RESTRICT); And each table created is populated as follows: MAKE MAKEID MAKE ------ -------- 1 Ford 2 Chevrolet 3 Toyota MODEL MODELID MODEL MAKEID ------- ------- -------- 1 Mustang 1 2 Escort 1 3 Malibu 2 4 Camry 3 If the following SQL statement is executed: DELETE FROM make WHERE makeid = 1 What is the total number of rows that will be deleted?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Question 24
Single choice
Given the following table: EMPLOYEE EMPID NAME INSTRUMENT --- --------------- ----- 1 Jagger, Mick 01 2 Richards, Keith 02 3 Wood, Ronnie 02 4 Watts, Charlie 03 5 Jones, Darryl 04 6 Leavell, Chuck 05 If the following query is executed: SELECT name, CASE WHEN instrument = '01' THEN 'HARMONICA' WHEN instrument = '02' THEN 'GUITAR' WHEN instrument = '03' THEN 'DRUMS' ELSE 'UNKNOWN' END AS instrument FROM employee What will be the results?
-
A
NAME INSTRUMENT --------------- -------- Jagger, Mick HARMONICA Richards, Keith GUITAR Wood, Ronnie GUITAR Watts, Charlie DRUMS Jones, Darryl ERROR Leavell, Chuck ERROR
-
B
NAME INSTRUMENT ------------------ -------- Jagger, Mick HARMONICA Richards, Keith GUITAR Wood, Ronnie GUITAR Watts, Charlie DRUMS Jones, Darryl 04 Leavell, Chuck 05
-
C
NAME INSTRUMENT ------------------ -------- Jagger, Mick HARMONICA Richards, Keith GUITAR Wood, Ronnie GUITAR Watts, Charlie DRUMS Jones, Darryl UNKNOWN Leavell, Chuck UNKNOWN
-
D
NAME INSTRUMENT ------------------ -------- Jagger, Mick HARMONICA Richards, Keith GUITAR Wood, Ronnie GUITAR Watts, Charlie DRUMS Jones, Darryl - Leavell, Chuck -
Reveal answer details
Close answer details
Question 25
Single choice
Which of the following will be a consequence of defining the column IDCOL2 in TABLE2 as a foreign key referencing the primary key (IDCOL1) of TABLE1?
-
A
DB2 will no longer allow updating the value of IDCOL1 in TABLE1.
-
B
When inserting a row in TABLE2, the only values that DB2 will allow for IDCOL2 are the existing values of IDCOL1.
-
C
When inserting a row in TABLE2, DB2 will only allow foreign values forIDCOL2, that is values which do not exist in IDCOL1.
-
D
When a SELECT statement joins TABLE1 with TABLE2, DB2 will automatically add the condition TABLE1.IDCOL1=TABLE2.IDCOL2 if not specified in the statement.
Reveal answer details
Close answer details
Question 26
Single choice
Which of the following is a feature of a unit of work?
-
A
It applies to a single data server.
-
B
It is a recoverable sequence of operations.
-
C
Its value can be queried from the system catalog tables.
-
D
It begins when the application connects to the data server.
Reveal answer details
Close answer details
Question 27
Single choice
Which of the following is NOT a characteristic of a unique index?
-
A
Each column in a base table can only participate in one uniqueindex, regardless of how the columns are grouped (the same column cannot be used in multiple unique indexes)
-
B
In order for an index to be used to support a unique constraint, it must have been defined with the UNIQUE attribute
-
C
A unique index cannot be created for a populated table if the key column specified contains more than one NULL value
-
D
A unique index can only be created for a non-nullable column
Reveal answer details
Close answer details
Question 28
Single choice
Given the following table definition: STOCK: item VARCHAR(30) status CHAR(1) quantity INT price DEC(7,2) If items are indicated to be out of stock by setting STATUS to NULL and QUANTITY and PRICE to zero, which of the following statements would be used to update the STOCK table to indicate that all the items whose description begins with the letter "S" are out of stock?
-
A
UPDATE stock SET (status = NULL; quantity, price = 0) WHERE item LIKE S%
-
B
UPDATE stock SET (status, quantity,price) = (NULL, 0, 0) WHERE item LIKE S%
-
C
UPDATE stock SET status = NULL, SET quantity = 0, SET price = 0 WHERE item LIKE 'S%'
-
D
UPDATE stock SET (status = NULL), (quantity = 0), (price = 0) WHERE item LIKE S%
Reveal answer details
Close answer details
Question 29
Single choice
Which of the following is used to create and debug user-defined functions?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Question 30
Single choice
Given the following UPDATE statement: UPDATE employees SET workdept = (SELECT deptno FROM department WHERE deptno = 'A01') WHERE workdept IS NULL Which of the following describes the result if this statement is executed?
-
A
The statement will fail because an UPDATE statement cannot contain asubquery.
-
B
The statement will only succeed if the data retrieved by thesubquery does not contain multiple records.
-
C
The statement will succeed; if the data retrieved by thesubquery contains multiple records, only the first record will be used to perform the update.
-
D
The statement will only succeed if every record in the EMPLOYEES table has a null value in the WORKDEPT column.
Reveal answer details
Close answer details
Question 31
Single choice
An application needs to store a 5 MB JPEG image in a DB2 table. Which data type should be specified for the column that will be used for storing the image?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Question 32
Single choice
Which of the following will begin a new unit of work?
-
A
-
B
The first FETCH of a cursor
-
C
The BEGIN TRANSACTION statement
-
D
The first executable SQL statement
Reveal answer details
Close answer details
Question 33
Single choice
Which of the following statements is used to revoke all DML privileges on table EMPLOYEE from user TOM?
-
A
REVOKE ALL PRIVILEGES FROM USER tom
-
B
REVOKE ALL ON EMPLOYEE FROM USER tom
-
C
REVOKE EXECUTE ON EMPLOYEE FROM USER tom
-
D
REVOKE PRIVILEGES ON EMPLOYEE FROM USER tom
Reveal answer details
Close answer details
Question 34
Single choice
If table TAB1 is created using the following statement: CREATE TABLE tab1 (col1 INTEGER NOT NULL, col2 CHAR(5), CONSTRAINT cst1 CHECK (col1 in (1, 2, 3))) Which of the following statements will successfully insert a record into table TAB1?
-
A
INSERT INTO tab1 VALUES (0, 'abc')
-
B
INSERT INTO tab1 VALUES (NULL, 'abc')
-
C
INSERT INTO tab1 VALUES (ABS(2), 'abc')
-
D
INSERT INTO tab1 VALUES (DEFAULT, 'abc')
Reveal answer details
Close answer details
Question 35
Single choice
Given the following statement: CREATE TABLE tab1 (col1 SMALLINT NOT NULL PRIMARY KEY, col2 VARCHAR(200) NOT NULL WITH DEFAULT NONE, col3 DECIMAL(5,2) CHECK (col3 >= 100.00), col4 DATE NOT NULL WITH DEFAULT) Which of the following definitions will cause the CREATE TABLE statement to fail?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Question 36
Single choice
Which of the following is an accurate statement about packages?
-
A
Packages provide a logical grouping of database objects.
-
B
Packages contain control structures that are considered the bound form for SQL statements
-
C
Packages describe the objects in a DB2 database and their relationship to each other
-
D
Packages may be used during query optimization to improve the performance for a subset of SELECT queries
Reveal answer details
Close answer details
Question 37
Single choice
Which of the following tools for DB2 V9 allows a user to create and debug a SQL stored procedure?
-
A
-
B
-
C
-
D
Stored Procedure Builder Security
Reveal answer details
Close answer details
Question 38
Single choice
Which of the following DB2 objects is NOT considered executable using SQL?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Question 39
Single choice
Which of the following statements is used to prevent user TOM from adding and deleting data in table TAB1?
-
A
REVOKE ADD, DELETE FROM USER tom ON TABLE tab1
-
B
REVOKE ADD, DELETE ON TABLE tab1 FROM USER tom
-
C
REVOKE INSERT, DELETE FROM USER tom ON TABLE tab1
-
D
REVOKE INSERT, DELETE ON TABLE tab1 FROM USER tom
Reveal answer details
Close answer details
Question 40
Single choice
Which of the following actions will NOT cause a trigger to be fired?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Question 41
Single choice
An index named EMPID_X exists for a table named EMPLOYEE. Which of the following will allow user USER1 to drop the EMPID_X index?
-
A
GRANT DROP ON INDEXempid_x TO user1
-
B
GRANT DELETE ON INDEXempid_x TO user1
-
C
GRANT INDEX ON TABLE employee TO user1
-
D
GRANT CONTROL ON INDEXempid_x TO user1
Reveal answer details
Close answer details
Question 42
Single choice
Which of the following DB2 products are required on an iSeries or System I server to enable an application running on that server to retrieve data from a DB2 database on a Linux server?
-
A
-
B
-
C
DB2 ConnectEnterprise Edition
-
D
DB2 for i5/OS SQL Development Kit
Reveal answer details
Close answer details
Question 43
Single choice
Given the following table: TAB1 COL1 COL2 ----- ----- A 10 B 20 C 30 D 40 E 50 And the following SQL statements: DECLARE c1 CURSOR WITH HOLD FOR SELECT * FROM tab1 ORDER BY col_1; OPEN c1; FETCH c1; FETCH c1; FETCH c1; COMMIT; FETCH c1; CLOSE c1; FETCH c1; Which of the following is the last value obtained for COL_2?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Question 44
Single choice
Given the following table: CURRENT_EMPLOYEES -------------------------------------- EMPID INTEGER NOT NULL NAME CHAR(20) SALARY DECIMAL(10,2) PAST_EMPLOYEES -------------------------------------- EMPID INTEGER NOT NULL NAME CHAR(20) SALARY DECIMAL(10,2) Assuming both tables contain data, which of the following statements will NOT successfully add data to table CURRENT_EMPLOYEES?
-
A
INSERT INTOcurrent_employees (empid) VALUES (10)
-
B
INSERT INTOcurrent_employees VALUES (10, 'JAGGER', 85000.00)
-
C
INSERT INTOcurrent_employees SELECT empid, name, salary FROM past_employees WHERE empid = 20
-
D
INSERT INTOcurrent_employees (name, salary) VALUES (SELECT name, salary FROM past_employees WHERE empid = 20)
Reveal answer details
Close answer details
Question 45
Single choice
What does the following statement do?
-
A
Gives USER1 the ability to change the comment associated with a sequence named GEN_EMPID, along with the ability to give this CONTROL authority for the sequence to other users and groups.
-
B
Gives USER1 the ability to change the values returned by the PREVIOUS_VALUE and NEXT_VALUE expressions associated with a sequence named GEN_EMPID, along with the ability to give CONTROL authority for the sequence to other users and groups.
-
C
Gives USER1 the ability to change the comment associated with a sequence named GEN_EMPID, along with the ability to give this authority to other users and groups.
-
D
Gives USER1 the ability to change the values returned by the PREVIOUS_VALUE and NEXT_VALUE expressions associated with a sequence named GEN_EMPID, along with the ability to give this authority to other users and groups.
Reveal answer details
Close answer details
Question 46
Single choice
Given the following table: TAB1 COL1 COL2 ----- ----- A 10 B 20 C 30 A 10 D 40 C 30 Assuming the following results are desired: TAB1 COL1 COL2 ----- ----- A 10 B 20 C 30 D 40 Which of the following statements will produce the desired results?
-
A
SELECT UNIQUE * FROM tab1
-
B
SELECT DISTINCT * FROM tab1
-
C
SELECTUNIQUE(*) FROM tab1
-
D
SELECTDISTINCT(*) FROM tab1
Reveal answer details
Close answer details
|