|
一、单选题(共 25 道试题,共 100 分。) V 1. Given the tables: EMPLOYEE DEPT emp_num emp_name dept dept_id dept_name 1 Adams 1 1 Planning 2 Jones 1 2 Support 3 Smith 2 4 Williams 1 and the statement: ALTER TABLE employee ADD FOREIGN KEY (dept) REFERENCES dept (dept_id) ON DELETE CASCADE How many rows will be deleted when the following statement is executed? DELETE FROM employee WHERE dept=1
. J' z4 |4 w" E9 h0 J& uA. 08 z6 j- q4 d B b' s
B. 1
- v1 H2 G0 q; C5 I m4 a2 u$ A! qC. 3& O5 _! k* C* P( l a+ d
D. 4
/ Y& ] M( k9 L1 ~8 E, V; t' @) H* O, o. h
2. Given the following code: BEGIN ATOMIC UPDATE country SET cities=:count WHERE CURRENT OF C1; INSERT INTO country VALUES(:co11,:co12,:co13); INSERT INTO country VALUES(:co14,:co15,:co16); INSERT INTO country VALUES(:co17,:co18,:co19); INSERT INTO country VALUES(:co110,:co111,:co112); COMMIT; END Given that all statements succeed except the following: INSERT INTO country VALUES(:co17,:co18,:co19); How many rows will be affected in table COUNTRY?
9 q- x5 q% i6 D2 HA. 0
% `- L- o, L6 DB. 3' v7 I; J/ \9 Q8 F- R6 O/ ]
C. 4
2 \6 l; c Z2 x6 ~# g. yD. 56 U5 W8 A0 n* C1 d' s& \" n; _
/ a, y, K6 j0 O- @4 |, h# U" o( @3. How many rows can be retrieved using a single SELECT INTO statement?+ H; H2 `2 n7 M' Z9 h% c' H1 M
A. Only one row
( |" j, `) B- T( r- rB. As many as are in the result
+ E2 w3 @, n' a. T, f7 lC. As many as are host variables used in the call% U! H/ e1 T4 c! J q0 j0 b
D. As many as host variable array structures can hold
8 A. k- d0 R7 ^( `% }; H
4 @& I9 u' v' r8 ]; O# B' z6 K# W2 X4. 实体是信息世界中的术语,与之对应的数据库术语为:()
1 g7 c8 G4 ?- R2 ]7 B( IA. 文件
6 Z5 E6 Z5 `/ Q& z- Q# n; hB. 数据库* v0 ~) v% {( g& R- n9 P8 |
C. 字段& X4 W$ w( C- k& Q: U: d
D. 记录* P: ~9 M* Q; r2 y5 x
. ~) [+ N _" p; G( N, j
5. 如果开发人员在AIX操作系统上开发访问后台AS400上的DB2数据库,则需要在AIX开发环境中安装:()9 k9 j+ y1 k# ^
A. DB2个人开发版(PDE)
5 Y3 \" S, \( s% i1 Y! B, |. xB. DB2通用开发版(UDE)9 H: ~9 w3 c& I. I# p
" }. V3 Q& H/ c# M. c' H6. 关系模型中的关系模式至少是()% }( i G: t$ ]0 _# K
A. 1NF
# e" F k0 B6 I1 TB. 2NF3 G, e' k F+ L) V& ?
C. 3NF+ G! T! f3 @3 m5 z+ m
D. BCNF+ S8 U8 H7 V# `3 q* p9 ]
( y! H5 y' l) B8 ^# E% Q! E# v% R7. 若用如下的SQL语句创建一个student表: CREATE TABLE student(NO CHAR(4) NOT NULL, NAME CHAR(8) NOT NULL, SEX CHAR(2), AGE NUMBERIC(2))可以插入到student表中的是哪一项?2 P" X: Q2 ?9 P
A. (‘1031’,‘曾华’,男,23)8 K' \0 P; Y F) p
B. (‘1031’,‘曾华’,NULL,NULL)
4 ?, |0 m1 H' q1 L0 E( VC. (NULL,‘曾华’,‘男’,‘23’)
& b1 q" ?' N. |( c2 x: nD. (‘1031’,NULL,‘男’,23)
9 l) e2 F; U- _2 j7 [
; Q- m" i/ x: {9 g# L8. 执行下面两条SQL语句后: CREATE TABLE t1 ( c1 char(10) NOT NULL PRIMARY KEY, c2 int, c3 char(10), c4 char(10) NOT NULL, CONSTRAINT c4 UNIQUE (c1,c4) ) //自动创建索引 CREATE INDEX Index1 ON t1 (c2 ASC) 表t1上有几个索引?0 ?; k) ~$ a4 R* r3 f
A. 0 c% ~: C& j$ s+ x6 L$ c
B. 1/ E, Z9 U# y+ x% e% w4 b7 p! Z
C. 2
* i6 k- O. V% r. W. y" d ]D. 3; ]. u+ w/ }" t- s$ |8 G4 {* z
E. 4
0 R4 S( y& `0 i; _/ }& E
1 h. {' M2 ]1 C4 {8 I9. Given the code: EXEC SQL WITH most_cities AS ( SELECT b.id, b.name, a.cities FROM country a, staff b WHERE a.person = b.id AND cities > :threshold ) SELECT id, name, cities FROM most_cities INTO :id, :name, :cities WHERE cities IN (SELECT MAX(cities) FROM most_cities) Which of the following can reference MOST_CITIES?
4 X5 u# Q2 u% L& a" U" JA. The current statement: i& h: P7 N9 m) z. _# D
B. Statements from any application
; Z4 b: B5 [4 _" @ d- K+ MC. All statements within this application( J% m3 S3 C% E; ?* c: }
D. All statements within the current unit of work8 e* A& T' c, Y4 G
8 Z: g$ E& ?7 v9 D$ Z10. An application uses static SQL to connect to a remote DB2 server and inserts data into the CUST.ORDERS table on that remote DB2 server. To enable access to the remote DB2 server, FOO needs to create a package with default options so that BAR is the only non-administrative user that can use this package on the remote DB2 server. Which statement describes the privileges that FOO requires to accomplish this?
% F9 |; |3 Y3 r( C. YA. FOO requires EXECUTE privilege on the package.
3 S5 f4 y, t" k- h+ I# Q6 |" {B. FOO requires the privilege to create the package on the remote DB2 server.
. u1 u3 m/ F; R' U6 EC. FOO requires EXECUTE privilege on the package and INSERT privilege on CUST.ORDERS.
" h8 E# q5 X: J% |' B5 N1 gD. FOO requires the privilege to create the package on the remote DB2 server and INSERT privilege on CUST.ORDERS.
& Z4 T c' {; U+ F7 [) S& ^; f
' }* h7 Y" U( F/ a) _4 W9 X' o3 j11. Given the table T1 with the following data: COL1 IDX ---- ---- A single-threaded CLI application executes the following pseudocode in sequence: SQLAllocHandle( SQL_HANDLE_ENV, NULL, &hEnv ) SQLAllocHandle( SQL_HANDLE_DBC, hEnv, &hDbc ) SQLConnect( hDbc, "SAMPLE", SQL_NTS, NULL, SQL_NTS, NULL, SQL_NTS ) SQLSetConnectAttr( hDbc, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_ON ) SQLAllocHandle( SQL_HANDLE_STMT, hDbc, &hStmt ) SQLExecDirect( hStmt, "UPDATE table1 SET col1=10 WHERE idx=1", SQL_NTS ) SQLExecDirect( hStmt, "UPDATE table1 SET col1=20 WHERE idx=2", SQL_NTS ) SQLEndTran( SQL_HANDLE_DBC, hDbc, SQL_COMMIT ) SQLExecDirect( hStmt, "UPDATE table1 SET col1=30 WHERE idx=1", SQL_NTS ) SQLExecDirect( hStmt, "UPDATE table1 SET col1=40 WHERE idx=1", SQL_NTS ) SQLEndTran( SQL_HANDLE_DBC, hDbc, SQL_ROLLBACK ) SQLExecDirect( hStmt, "SELECT col1 FROM table1 WHERE idx=1", SQL_NTS ) Which of the following values for COL1 will be fetched when the sequence for the pseudocode listed above is successfully executed?
# Z/ `2 h/ V! M4 PA. 10
5 q' t4 l; m- \B. 20. f0 B5 M3 j2 r# c$ V! U
C. 30
0 B- R+ O$ N) ]1 CD. 40
* H7 ^$ g5 Z2 d! K0 r3 C* O& a/ a" ]
12. 下面哪个工具可以保存终端用户需要存取的元数据?. G, D3 ^! t% x5 N" f# G, g- l3 |
A. Query Management Facility* {) Z! M/ n2 A) z% ?
B. DB2 Query Patroller
8 ?2 j/ {9 O% }( _ g0 ~6 tC. DB2存储过程构建器9 N) t5 _2 H$ B* Q# p/ d* D" {2 q
D. 信息目录, E/ ?. R& t, B$ X0 c1 U
. `. G `# R6 m) I% c13. 设有两个事务T1,T2,其并发操作如下所示: T1: T2: 1) 读A=10,B=5 2) 读A=10 3) 读A=20,B=5 求和25 验证错正确的评价是哪个?
) l' A' B. o1 c0 \7 NA. 该操作不存在问题
' H) g5 L2 A+ ]; t5 @3 oB. 该操作丢失修改9 S0 }1 t/ L, \( h# ]- ^0 P- D
C. 该操作不能重复读0 D9 T# `0 T; i9 l( W$ G+ w& {6 [4 N
D. 该操作读“脏”数据
7 ?% o- t8 S1 e8 @9 f: p" p
0 `& K% H& k4 u: X9 c. j14. 关系规范化中的删除操作异常是指()
' ~; G/ i% Y+ j" Y& e* \$ q0 ?A. 不该删除的数据被删除0 t- ]8 d1 }2 P. G
B. 不该插入的数据被插入
8 `/ L! }- g0 B/ s+ ~+ h2 RC. 应该删除的数据未被删除: ?+ h. d; Z% I1 `5 i
D. 应该插入的数据未被插入
3 }% l! \$ z) v4 _7 s7 ^/ c# f; c* `
9 L! _5 g; X/ b* {15. Given the table COUNTRY with the following data: ID NAME PERSON CITIES -- ---- ------ ------ 1 Argentina 1 - and the code: EXEC SQL DECLARE c1 CURSOR FOR SELECT id,name FROM country; EXEC SQL OPEN c1; EXEC SQL FETCH c1 INTO :id,:name; EXEC SQL FETCH c1 INTO :id,:name; Which of the following SQLCODE/SQLSTATEs will be contained in the SQLCA after the last fetch?
1 i, g+ g) D& w" r8 UA. SQLCODE 0, SQLSTATE 00000+ ]' q# f% D+ X; s. A+ w0 c A# L. X
B. SQLCODE 100, SQLSTATE 02000/ ?! J6 K8 y* ? H; I' k U
C. SQLCODE -100, SQLSTATE 00100
. [9 B- F/ m5 s- |5 h+ q( GD. SQLCODE -501, SQLSTATE 24501
0 S2 E! W* N. e( _
6 D* O7 ?2 n- ~. c% C! P0 b16. Given the following code: EXEC SQL EXECUTE IMMEDIATE :sqlstmt Which of the following values must sqlstmt contain so that all rows are deleted from the STAFF table?4 D5 l0 }7 h' Q# P
A. DROP TABLE staff$ h; l- i. t0 S: L4 Y! @2 R* n
B. DELETE FROM staff9 |& m. R8 c3 J- b; N" [
C. DROP * FROM staff
1 a, [& Q+ B0 j& g8 [D. DELETE * FROM staff
2 o, J- i! D: d* q2 U# ~! h$ @' Y% A. q' {& d& N" ^
17. The following commands are issued against a data source: CREATE TABLE userid.org ( i INT) CREATE ALIAS user1.org FOR userid.org CREATE TABLE org.sample ( c CHAR(1)) CREATE ALIAS sample.org FOR userid.org CREATE ALIAS userid.sample FOR sample.org When issued by USER1, which of the following statements will have a different result set than this SELECT statement? SELECT * FROM org# w) @: M( V2 E& U; \' P
A. SELECT * FROM org.sample
. O3 e0 V R5 fB. SELECT * FROM sample.org0 p" M. U1 K) B2 ~/ R
C. SELECT * FROM userid.org8 B' X( l1 Q6 O/ D" j
D. SELECT * FROM userid.sample7 b! V3 m( L: V
0 n0 n' |7 ]$ p6 ]/ X, \# v
18. Which of the following is used to run an embedded dynamic SQL UPDATE statement?& M9 d) o: A( J% `
A. UPDATE% l5 F- T* u9 E% L0 N
B. . PREPARE2 k+ E# X/ b, _- Z
C. . DECLARE2 B5 K" q# V2 ?4 d
D. . EXECUTE
+ e4 }' F+ |+ B9 E
6 X9 {& d8 G6 |, P* }# C19. Which of the following is TRUE for all cursors defined as FOR FETCH ONLY?
3 w% a) J4 ?( b1 AA. The cursors are unambiguous.
: M9 w6 I+ j% ]0 b# p. P1 ZB. Only the first row is returned./ x7 ~: K" i/ w, G5 G' H X
C. Cursor stays open after a commit.8 L4 ^) ?) V. g
D. A temporary table is created on the server.
% S: s9 h+ w0 W" J# w6 l0 b7 q" x& H9 Q* X( I# W9 {! A
20. 在数据库中存储的是:()
; o9 c( B3 P5 o+ | p( IA. 数据
- f0 o# T) r* F; ~0 FB. 数据模型
& H, o3 b6 _8 L$ G8 c8 T% x; aC. 数据以及数据之间的联系( |; \- Y" ^- A% v
D. 信息$ P8 h) U$ B: |6 V/ L4 Z* m" P# i
* r+ j/ R/ O0 x `3 x, u1 G( b
21. 在语句CREATE VIEW EMP_VIEW2 (EMPNO, EMPNAME, DEPTNO, JOBTITLE, HIREDATE) AS SELECT ID, NAME, DEPT, JOB, HIREDATE FROM EMPLOYEE WHERE DEPT=10 WITH CHECK OPTION; 所定义的视图中,当使用INSERT语句时,若新增的行中DEPTNO数值不为10,则该行将被拒绝插入。* W8 K G& P* f" U8 F q5 j( n$ E+ b
A. 正确
9 m2 A1 v) r) k+ l s, zB. 错误
8 P5 ~/ |7 |4 t2 i2 F% l+ R8 L+ H, Q9 B
22. 创建一个DMS类型的表空间,可以使用以下哪两种文件系统对象作为容器?% e) h" O' @, C, j" X- X, h
A. 目录
! E6 t' \( H# ?# A* E" k- EB. 文件
1 y8 ]" p. }& I# u5 B+ o) GC. DEVICE* M6 g( X+ G/ R; E6 R4 M# ^4 R
. V2 U s8 {; w2 y23. 如果一个用户USER1被授予了表TAB上的CONTROL特权,如果需要限制该用户对表的存取,应使用以下哪条命令?
) h1 Z: G3 [1 l4 }A. REVOKE ALL ON TAB TO USER1
: n) R) y/ {/ xB. REVOKE ALL ON TAB FROM USER10 h' r: |0 p) q
C. REVOKE CONTROL ON TAB TO USER1) T, ?/ _6 X& {8 w. `
D. REVOKE CONTROL ON TAB FROM USER1
1 P8 ^1 b; v+ B6 X/ n, h p3 s9 h8 F
24. 定义基本表时,若要求某一列的值不能为空,则应在定义时使用什么保留字?但如果该列是主键,则可省写。
( a, f% J5 a C2 w+ p: }$ fA. NULL- S6 O5 s; j6 e
B. NOT NULL9 g# y, a& p0 l! V/ O! ?! Z. f
C. DISTINCT) x7 O F" O- Z p# m0 i+ D/ Y% R
D. UNIQUE3 u3 h& c& V' P1 S7 W
, m9 @! |% m& D3 P, Z, j25. 据库系统和文件系统的主要区别是:6 ]- e7 d- h5 b
A. 数据库系统复杂,而文件系统简单。
4 \% R" _- P' O9 c0 HB. 文件系统不能解决数据冗余和数据独立性问题,而数据库系统可以解决。2 z3 s# L, K2 Y0 k
C. 文件系统只能管理程序文件,而数据库系统能够管理各种类型的文件。: m' o: G1 X1 z7 y4 l( `
D. 文件系统管理的数据量较少,而数据库系统可以管理庞大的数据量。( R7 d: z; B6 }$ x c" i
. m6 S" V0 l* W. C% H
% m5 o7 \$ l! g, V5 v$ G$ Q7 s
" g$ e# S( j8 X- f; K% N. R : c, K$ x0 V* G, k" j' v4 V' F5 g
7 r! g! W8 _( N
$ i5 p5 k+ J( B# \0 O ^1 i
0 z9 ^/ m1 \! k9 N
9 X7 r0 \4 B9 W: E$ }3 w9 y! x( Y0 C% K, N5 p1 ?6 f
" e. M+ t" W) M1 u b3 ~2 X, A5 W. K- f$ U, ^' b
# d* D% t+ R0 x: A+ r6 ~' [% J; r& L9 e k0 D2 C
' i' o8 {* L5 R2 q" \
2 V1 O6 v# V: Z; n- m' P- a( w |
|