Db2考试测试题

  • Upload
    fm2008

  • View
    1.094

  • Download
    4

Embed Size (px)

Citation preview

DB2

DB21

-------------------------------------------------------------------------------- 1) Which of the following products is required to be installed in order to build an application on AIX, which will access a DB2 UDB for OS/390 database? a) DB2 Connect Personal Edition b) DB2 Universal Database Workgroup Edition c) DB2 Personal Developer's Edition d) DB2 Universal Developer's Edition OK

2) Which of the following tools can be used to catalog a database? a) Journal b) Alert Center c) License Center d) Configuration Assistant OK

3) Which of the following utilities would you run to order data and reclaim space from deleted rows in a table: a) reorg OKb) db2look c) db2move d) runstats

# the detail in file reorg vs runstats.txt

4) 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. OKd) create table spaces within a database.

5) Which two of the following authorities can create a database? a) DBADM b) SYSADM c) DBCTRL d) SYSCTRL e) SYSMAINT

6) 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 users and applications. OKc) 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.

7) Given the create statements: CREATE DISTINCT TYPE kph AS INTEGER WITH COMPARISONS CREATE DISTINCT TYPE mph AS INTEGER WITH COMPARISONS CREATE TABLE speed_limits (route_num SMALLINT, canada_sl KPH NOT NULL, us_sl MPH NOT NULL) Which of the following is a valid query? 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)

8) If, for a given table, the Control Center does not show the choice Generate DDL, which of the following describes the reason? a) The table is a system object. b) The table is a summary table. ?c) The table is in LOAD PENDING. d) The table is a replicated table. e) The table was created by a different user .

9) 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) OK

10) 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'

11) 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 Extenders d) DB2 XML Extenders e) DB2 Text Extenders

12) Which of the following CANNOT have an autocommit setting? a) Embedded SQL b) The Command Center c) The Command Line Processor d) The DB2 Call Level Interface

13) Which of the following statements eliminates all but one of each set of duplicate 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

14) Given the table: STAFF ID LASTNAME 1 Jones 2 Smith 3 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 ALL FROM staff WHERE lastname IS NULL c) DELETE FROM staff WHERE lastname = 'NULL' d) DELETE ALL FROM staff WHERE lastname = 'NULL'

15) 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) Which of the following statements will list every employee's number and last name with the employee number and last name of their manager, including employees witho ut a manager? a) SELECT e.empno, e.lastname, m.empno, m.lastname FROM employee e LEFT I NNER 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 OUTER 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 RIGHT 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 INNER JOIN department INNER JOIN employee m ON mgrno = m.empno ON e.workdept = deptno

16) 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 11 Mats Sundin 13

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 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, numbers, p oints and PIM for all players with an entry in all three tables? a) SELECT names.name, names.number, points.points, pim.pim FROM names INN ER JOIN points ON names.name=points.name INNER JOIN pim ON pim.name=names.nam e b) SELECT names.name, names.number, points.points, pim.pim FROM names OUT ER JOIN points ON names.name=points.name OUTER JOIN pim ON pim.name=names.nam e c) SELECT names.name, names.number, points.points, pim.pim FROM names LEF T 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 RIG HT OUTER JOIN points ON names.name=points.name RIGHT OUTER JOIN pim ON pim.na me=names.name

17) Given the tables: EMPLOYEE emp_num emp_name dept 1 Adams 1 2 Jones 1 3 Smith 2 4 Williams 1

DEPT dept_id dept_name 1 Planning 1 Support and the statement: ALTER TABLE employee ADD FOREIGN KEY (dept) REFERENCES (dept_id) ON DELETE CASCADE

How many units of work will be needed to process this statement: DELETE FROM dept WHERE dept_id=1 a) 0 b) 1 c) 2 d) 3 e) 4 f) 6

1 Given the requirements to store names, employee numbers, and when the emp loyees were hired, which of the following DB2 data types CANNOT be used to co ntain the day the employee was hired? a) CLOB b) TIME c) VARCHAR d) TIMESTAMP

19) Given the transaction: "CREATE TABLE t1 (id INTEGER,CONSTRAINT chkid CHECK (id