|
一、单选题(共 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
- T' B& V# r6 b! n) _& Q7 jA. 0
, e) Q/ A, w$ Z8 X8 B$ N" K9 ?9 wB. 1
8 H. I; q$ y1 J! j( h1 {C. 3
( s, B7 x2 Y' H% h6 _9 TD. 4 Q( o, o9 U1 {+ `0 A) I8 K: m
9 H! H0 _) R) k9 ?. Y2. 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?
8 D+ d; C3 Q( C; n$ }0 k {* A ]" AA. 04 g1 u; D' ?% i- T l
B. 3
4 y9 F" j2 y6 I& k9 b& }C. 46 w& t# q1 u3 E) D1 S
D. 5
) Y" W% _% o8 c% n! S) [8 C
6 M9 i* I+ {0 @ N$ d: y$ ~3. How many rows can be retrieved using a single SELECT INTO statement?6 H9 ?. \3 C6 q' P, m) }
A. Only one row
+ ^: m7 g1 Y" |7 X, tB. As many as are in the result
& D B9 }( _( O8 t) X! T/ ]C. As many as are host variables used in the call1 h0 T |/ Y: J: N- ]0 q7 q
D. As many as host variable array structures can hold5 N2 S7 U/ s ~9 k5 w- h! }9 [
# r" k! T( _/ q z1 m- Z# e/ T4. 实体是信息世界中的术语,与之对应的数据库术语为:()
# T c& q/ m' M5 }0 d% F9 BA. 文件
; j3 z8 t: e# j- X8 OB. 数据库( n+ n3 F% q+ I: S6 [
C. 字段
: P& f' m- @0 L. eD. 记录
! V! t- p. [2 x4 _! B( ?2 D& r+ W m, { w
5. 如果开发人员在AIX操作系统上开发访问后台AS400上的DB2数据库,则需要在AIX开发环境中安装:()
$ r# J5 _# o! ~1 R' {6 y/ J- BA. DB2个人开发版(PDE)
8 z' \# `4 K( s/ d' D1 ^B. DB2通用开发版(UDE)
7 r5 O* B6 v5 B! h; A: {8 G4 }1 {: s5 K9 U7 e3 J$ X% h* f t
6. 关系模型中的关系模式至少是() P+ W. @* ?+ H6 k# E' [. d
A. 1NF& G: g: K, P' s* J
B. 2NF
8 C! e9 \; F' P tC. 3NF v, k% V! S1 r" f7 M2 R
D. BCNF
3 o6 M. K/ ^+ S! {1 f- T& P- H' K; Q, R0 k) |: A) O8 t
7. 若用如下的SQL语句创建一个student表: CREATE TABLE student(NO CHAR(4) NOT NULL, NAME CHAR(8) NOT NULL, SEX CHAR(2), AGE NUMBERIC(2))可以插入到student表中的是哪一项?
. r! k: A4 ~. ]& GA. (‘1031’,‘曾华’,男,23)0 c3 {( |1 m; T
B. (‘1031’,‘曾华’,NULL,NULL); `/ R$ N# o4 \( L* G5 J
C. (NULL,‘曾华’,‘男’,‘23’)1 B* K6 h0 E ?5 ]0 w1 D; {4 ^
D. (‘1031’,NULL,‘男’,23)
- t0 o; C) H1 _7 R' v3 m+ i+ [" s
8. 执行下面两条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上有几个索引?( n' d/ Z8 e5 d0 q+ r* g
A. 0
- A4 B( E9 x( d+ j7 D( q9 D8 j# V( ]B. 19 n6 ^% \% f5 C2 W7 P5 P" S# G3 K. G
C. 2
$ C; a* U0 p8 z' l8 P. K3 R$ O" \D. 3
/ k4 l! r! m* Z& X8 K# E. p1 \E. 47 b2 q, T. L ]* T
0 d/ @, w, w! {* e3 Z7 f+ n
9. 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?
: G* ~6 O! n" {0 {0 J8 U- ?+ y0 EA. The current statement2 ^- j# f; D9 w+ {" o8 ~( n% S! {
B. Statements from any application
( _8 F& J) \; tC. All statements within this application+ \# S; V( n+ r( k: m5 l& j
D. All statements within the current unit of work5 ?- h7 v, s: |4 X \9 O( o
/ k7 T, s& m/ p! E, ]10. 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?
& h5 J9 k* E, EA. FOO requires EXECUTE privilege on the package.
% f0 f; P: x. t; r% {B. FOO requires the privilege to create the package on the remote DB2 server.. X. O) R# w& F0 [/ v
C. FOO requires EXECUTE privilege on the package and INSERT privilege on CUST.ORDERS.
1 X, R) b% t) v/ wD. FOO requires the privilege to create the package on the remote DB2 server and INSERT privilege on CUST.ORDERS.( u- _& u' t% [5 w8 j
! l+ y2 r8 m: _8 e11. 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?5 X6 o. k. W& n
A. 10; U/ n% m9 N1 n+ v" N9 a( b
B. 20* ^! B' U% \7 O: x
C. 30
6 K2 s; M1 j! CD. 40$ I' R# f+ U6 n- i# k
/ u+ {, I2 h+ e12. 下面哪个工具可以保存终端用户需要存取的元数据?
2 W9 [7 ~3 o4 Q: F1 BA. Query Management Facility" {( C! H6 c" D$ Z
B. DB2 Query Patroller
M+ P0 Z, l5 gC. DB2存储过程构建器
1 u+ |$ _& Y6 U7 A7 q- d& r+ tD. 信息目录6 b) a$ n" r$ S
# n, }" R$ ?7 c; o; W# ?4 M13. 设有两个事务T1,T2,其并发操作如下所示: T1: T2: 1) 读A=10,B=5 2) 读A=10 3) 读A=20,B=5 求和25 验证错正确的评价是哪个?
8 w6 x9 t8 S/ ^+ {' pA. 该操作不存在问题! d0 W* Y1 }1 |+ D
B. 该操作丢失修改+ V1 ]& L! d( R. s
C. 该操作不能重复读% E$ g4 P* ~2 E; |% s
D. 该操作读“脏”数据: V! ~. ~2 u% }1 y& Q/ V" S
% F, z7 {4 J3 z14. 关系规范化中的删除操作异常是指()
/ M8 ^9 P( U+ h" a) H: k" cA. 不该删除的数据被删除0 F/ N+ t. Q! P' z
B. 不该插入的数据被插入2 ?* |& [. Q" u" y7 h+ j
C. 应该删除的数据未被删除
5 E: d9 j) |9 a& e0 S7 z$ ^D. 应该插入的数据未被插入* v( d! V2 p$ a. _. {
7 D5 |- E1 }- C6 W% Z7 [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?
. Q O' e" |' `9 [* BA. SQLCODE 0, SQLSTATE 000008 L% S/ i4 D& Z K6 i
B. SQLCODE 100, SQLSTATE 02000
0 F% c0 u; \* PC. SQLCODE -100, SQLSTATE 00100
6 L5 T/ I# s# ]8 b ]; ~; ZD. SQLCODE -501, SQLSTATE 24501: c. t) t7 Z. Y
+ m5 R: v) @5 m4 d1 T5 N: c& s16. 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?
; u) W" b8 r" Z: n- tA. DROP TABLE staff
" `9 O/ y: o& p C0 L1 QB. DELETE FROM staff
4 ]8 d* Z4 L& O! z% Y2 zC. DROP * FROM staff/ F }' c& Z( J8 V/ W
D. DELETE * FROM staff2 C6 q2 W& q4 l
7 ~2 l# [% J) S7 E2 o8 L, g
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
7 c2 t) G0 t0 f+ ]A. SELECT * FROM org.sample
! _; R# |5 S! v: Y ?3 U( e4 |5 {B. SELECT * FROM sample.org
; |% k) x( k6 ^C. SELECT * FROM userid.org
) Y! p1 j2 ]! v8 eD. SELECT * FROM userid.sample
; y0 Q2 v" A) R/ V G9 M" R7 |, r: p C: {
18. Which of the following is used to run an embedded dynamic SQL UPDATE statement?
; R+ I& f) z/ Z4 h' M, Q/ J, IA. UPDATE# L( v+ f% ~* z" ^: ^% x5 M- D0 C) g) p, Q6 |
B. . PREPARE
/ c `5 w9 e$ c) G( `C. . DECLARE' P9 J1 K# q- i4 X; e# F
D. . EXECUTE$ N$ g* E6 X2 ` k) C2 Q
1 D, m+ t" N6 h' Q6 Q* z( h( o* K6 n19. Which of the following is TRUE for all cursors defined as FOR FETCH ONLY?5 N* G- ]. i$ j/ J; T" Z
A. The cursors are unambiguous.
$ @* |) X1 l+ `6 _2 R% G- dB. Only the first row is returned.. e+ _; N2 b5 A8 j1 [
C. Cursor stays open after a commit.
& _ `( b/ v( {$ Z- l6 A" n9 pD. A temporary table is created on the server.2 a5 W+ O$ ?, Q1 s( I7 K/ [
" _8 }, U, }2 g0 r! G
20. 在数据库中存储的是:()
4 S, K: X6 R9 AA. 数据% f$ X) p2 F4 t; h! @
B. 数据模型
& T! p7 C" U% @( I0 lC. 数据以及数据之间的联系
9 X# u; D M1 B2 {D. 信息8 V# V1 ~4 u# d9 j4 e0 V& @- u
; S& C4 O/ W: A: S0 a5 n4 P; p
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,则该行将被拒绝插入。6 `" m* }0 v4 \6 u4 ]& ~: [$ p
A. 正确
$ d$ {8 Z; d# R8 o- V. {B. 错误, t# Y; r# Y* L% w1 ~9 a- C
; ~/ M& _( y3 S' K7 ?4 A7 l
22. 创建一个DMS类型的表空间,可以使用以下哪两种文件系统对象作为容器?
$ o- g& ~4 S5 _A. 目录
, \/ t* }6 |" [/ o! c6 CB. 文件" K) a M9 f( v& I1 V) C
C. DEVICE
; a! W, \9 u; [3 v+ Q2 l: U
, r9 C- d) Z2 z8 x23. 如果一个用户USER1被授予了表TAB上的CONTROL特权,如果需要限制该用户对表的存取,应使用以下哪条命令?. T0 h4 t* @+ w0 d! ~
A. REVOKE ALL ON TAB TO USER15 O2 n B) w1 N) N
B. REVOKE ALL ON TAB FROM USER16 P6 H0 w \/ t! }
C. REVOKE CONTROL ON TAB TO USER1& d& O. y! l* Y- P
D. REVOKE CONTROL ON TAB FROM USER1! C" E# M2 B! i- u8 [2 d% e+ d2 }6 q
' h( N, x8 _' P* |24. 定义基本表时,若要求某一列的值不能为空,则应在定义时使用什么保留字?但如果该列是主键,则可省写。/ R4 K7 w- y3 i/ @
A. NULL5 O0 I6 r/ l8 w. S! }! E" x: N
B. NOT NULL
5 ~# `& \9 e( v N8 I5 `& ^& PC. DISTINCT
2 R6 h, V7 B( l& D' ~D. UNIQUE
H+ b o: f7 q7 E. Z( Q" g& P: R4 N( t
25. 据库系统和文件系统的主要区别是:! w$ Y! o6 m2 L. h, ?
A. 数据库系统复杂,而文件系统简单。8 E& v6 l3 d3 e. f% }
B. 文件系统不能解决数据冗余和数据独立性问题,而数据库系统可以解决。 h( T$ I; I6 d/ q/ l
C. 文件系统只能管理程序文件,而数据库系统能够管理各种类型的文件。
O. K6 t( R; I3 `! O8 lD. 文件系统管理的数据量较少,而数据库系统可以管理庞大的数据量。
, C( X0 P0 q6 U4 a( {6 L: @
4 E4 R7 }1 D9 u: i
) X T$ a3 U% N0 O- x" U( T
, T" a. q8 ?0 O; P : t8 r N: [! [. U
( I/ ]* K9 g' v( l* a/ e
- H. d2 M& u2 x% J c6 p
, r+ f( ]4 G) X+ ?% p3 a$ `- F$ I2 N& J' C! S, A( k
) k; p5 j5 k& n# g* s1 H7 P' q
8 j+ M# t2 q9 I+ v5 A9 w1 b- D0 z
; P+ t+ C- H6 _& R" X' g# {& V
% I+ ?0 _" v. F* s2 z; F; H1 D i8 Z0 B' q5 f7 u5 D' |& ^* R
+ T; J% w5 z) F
$ F- v/ q0 P1 R; j( d8 J
|
|