|
一、单选题(共 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% L; c* ]2 ?- Z6 ^3 T
A. 01 L- g4 N3 j, P' m
B. 1 X4 w; m! B- N; H1 D
C. 3
2 k" c) C& o+ Z0 M hD. 48 K0 o4 k8 q( w
& G B8 s: L, i) A0 B
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?
- M% m+ C$ |+ |* w7 VA. 0
0 ^: ]/ f; B1 N* TB. 3! G: X$ N& t, w8 P
C. 4
b. S3 Z, u7 P1 ~) w/ qD. 5
* ~" Q: T. R/ j8 X' ]
9 V7 T8 Q0 x7 j1 f7 T( g+ H, U3. How many rows can be retrieved using a single SELECT INTO statement?0 K6 E. X3 X, {
A. Only one row( d, ^ p. {7 J; a0 \% z
B. As many as are in the result" `: L# w! ?- \4 G8 g `$ M
C. As many as are host variables used in the call+ L' \3 p' ~; g: ~. ^ Z7 ?* S0 t, M* ?
D. As many as host variable array structures can hold5 u! K' m( O, M' P1 g8 e) ?# i/ c
. }9 q; P( `8 D" i# z& t. [* [4. 实体是信息世界中的术语,与之对应的数据库术语为:()) P& s5 u/ k( }& W/ i0 n
A. 文件
+ ^4 }2 S7 k8 C) Y4 l" OB. 数据库
8 {( n: {8 e0 |9 z2 l- L7 |C. 字段
2 U- C3 y& W0 m) o& R4 p+ AD. 记录( a- q& q8 b& r+ _! `- x
3 _. j2 @1 J6 K" T+ _3 ?9 g* J3 W, L
5. 如果开发人员在AIX操作系统上开发访问后台AS400上的DB2数据库,则需要在AIX开发环境中安装:()
' n+ x5 i7 G) m0 r* qA. DB2个人开发版(PDE)
2 u6 o2 [ l8 D8 d1 qB. DB2通用开发版(UDE)
; u4 y5 E$ u3 y; B
1 C; p! A4 M9 i: ~5 J0 x4 q/ V7 o/ H6. 关系模型中的关系模式至少是()
! B8 X5 H( g. v* k& dA. 1NF
, F8 t! |8 n2 I" e z9 uB. 2NF
1 W% u" j9 v4 T" s- X; BC. 3NF
: e! X) |. q6 ?1 z1 G# J. BD. BCNF
; A$ j1 {- G& V) P b7 a* k+ W3 [9 R! I0 m1 T) ~4 D
7. 若用如下的SQL语句创建一个student表: CREATE TABLE student(NO CHAR(4) NOT NULL, NAME CHAR(8) NOT NULL, SEX CHAR(2), AGE NUMBERIC(2))可以插入到student表中的是哪一项?1 w: A Q4 |/ N% S# W. b
A. (‘1031’,‘曾华’,男,23)
* b3 m: f8 `" F% |" l. {! s% \B. (‘1031’,‘曾华’,NULL,NULL)* f2 \, W: E: L8 M- H% j
C. (NULL,‘曾华’,‘男’,‘23’)4 f# P" `7 z- m& a6 P$ ?
D. (‘1031’,NULL,‘男’,23)
H0 ?9 s N6 q! S" |* i$ {4 `0 ?5 U8 z ?4 ~
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上有几个索引?
/ {5 n8 J1 } h/ eA. 0
8 G- z! [2 s+ VB. 1
! A3 M# T' n( t$ O3 NC. 28 a( v1 }/ c0 ]$ J# k% c
D. 3: v* l% f1 `' R5 k+ F
E. 4
$ w8 |' \1 ^+ H' g
; C/ h. A5 ]5 h6 l* ~$ {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?8 k8 p' S2 Q3 K
A. The current statement, J5 _9 }8 R9 ^' u, h9 s
B. Statements from any application
* l+ | B+ m) e/ h: sC. All statements within this application
4 [! F/ `/ G2 p) S+ dD. All statements within the current unit of work
; L, q4 E7 B4 D! L3 G9 b( n% g- E& }" F% _& Y
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?/ g: [( p' R, W7 @( c
A. FOO requires EXECUTE privilege on the package.: K! @6 ~) C& s8 X
B. FOO requires the privilege to create the package on the remote DB2 server.
* ~+ j* A) f3 p0 @C. FOO requires EXECUTE privilege on the package and INSERT privilege on CUST.ORDERS.
U2 f* t- ]- O' c4 P a5 QD. FOO requires the privilege to create the package on the remote DB2 server and INSERT privilege on CUST.ORDERS.* I. b& r' Z* [$ H4 V- b0 w, h; _
" U6 Q! ]! R9 h11. 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?
8 V& |$ L" Q6 m* [2 k$ p/ e3 RA. 10
$ P: p# M8 A$ xB. 20; r1 _: t _1 o( R" O( a, {
C. 30. _+ X. ~" s1 p! p- N0 F5 E( T
D. 40
+ L. y0 _- L! ~; K
1 c X( Y B/ }3 u- b2 [! ^4 e12. 下面哪个工具可以保存终端用户需要存取的元数据?: d- N; _0 `0 u# E5 {
A. Query Management Facility
4 M' F/ x$ j% I4 b2 Q9 e$ f. L" {B. DB2 Query Patroller! o# [ s+ }" Q
C. DB2存储过程构建器
- D& ^0 n0 l( y% \D. 信息目录
8 S, z) a, K, k* `4 r5 ^6 K( b6 E, h# W
13. 设有两个事务T1,T2,其并发操作如下所示: T1: T2: 1) 读A=10,B=5 2) 读A=10 3) 读A=20,B=5 求和25 验证错正确的评价是哪个?: x: Z% s3 S. I& V* m K
A. 该操作不存在问题: x5 j. T$ A: F# h, O- }
B. 该操作丢失修改' ^% @% Q3 L3 @" k
C. 该操作不能重复读' ?& ?4 Q# e+ _/ |1 z; h! y
D. 该操作读“脏”数据
. X( K+ I. ~: S- b, |
% e3 F" x: Z! G3 i& X14. 关系规范化中的删除操作异常是指()" [# W1 e ?3 ?5 t8 S- c$ E" n
A. 不该删除的数据被删除! i& Q9 Z6 G) J
B. 不该插入的数据被插入
; l( s- X. e0 V% @ J6 jC. 应该删除的数据未被删除
2 k6 Y% X/ \' U; m: s2 qD. 应该插入的数据未被插入
) g( i0 m J" Q& w. d9 V/ a. W8 Y% D
+ Q' e4 U: n1 t3 m6 ~* ^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?/ v! f6 V0 E% }4 V$ |
A. SQLCODE 0, SQLSTATE 000006 i: N1 w8 i, R
B. SQLCODE 100, SQLSTATE 02000
4 ]. n3 q% B a: ^) {. _C. SQLCODE -100, SQLSTATE 001009 F O s- {! x+ s+ p
D. SQLCODE -501, SQLSTATE 24501. {% n M4 J' Q! a7 X$ S* c$ S+ G
( M( @: S1 `) \2 m* G2 ?8 f: @$ V& H
16. 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?! [8 i. k/ t, O6 k& y4 ^: x( A2 {0 `* G6 N
A. DROP TABLE staff6 H" F1 n- ]3 y5 ^
B. DELETE FROM staff
; `6 q+ q K' B% q0 tC. DROP * FROM staff9 B: u% p8 \# S0 ]
D. DELETE * FROM staff
8 O9 C" d" ]! b" j1 _; \3 z/ O( L2 L$ `# O' E) u
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* c! o: L% H, C5 \1 B' u, x2 {
A. SELECT * FROM org.sample
8 h% {$ R9 c+ o# g. wB. SELECT * FROM sample.org, q& m+ f" i+ _ h3 T- Q
C. SELECT * FROM userid.org; z0 U6 ]" d+ P& b& v
D. SELECT * FROM userid.sample
- e/ @: s% v% J+ M: F" i7 B
. B6 j7 @! W0 Q S18. Which of the following is used to run an embedded dynamic SQL UPDATE statement?
, g# G+ m) Z* }+ bA. UPDATE
1 J. M+ _7 e8 D, |4 F" GB. . PREPARE
% S8 B5 O6 `! U% D. yC. . DECLARE
: y# F# a+ _+ o6 `8 H) p. tD. . EXECUTE
* F8 w9 K4 j" }* }6 v+ |1 J8 {! J
# h4 i4 W( E6 ~, Q% c19. Which of the following is TRUE for all cursors defined as FOR FETCH ONLY?
% M N6 D" ?- JA. The cursors are unambiguous.! h7 `8 O# Y J; A! \- L% u
B. Only the first row is returned.
% j1 }0 S0 F# v! e$ g# nC. Cursor stays open after a commit.
2 s: H8 w( A. b7 }* GD. A temporary table is created on the server.4 K: |+ _' }( i5 R0 m4 a& Y3 q9 R3 t
, i# O4 G: W. F1 D" K; N$ P20. 在数据库中存储的是:(). l( }! V" s% U* A/ Y
A. 数据
1 d: U4 H* U+ ]( gB. 数据模型
" X/ T0 t$ p; q/ f% ]9 GC. 数据以及数据之间的联系( K3 D/ a) o, V; m n* A( x9 R
D. 信息
) O5 g3 ]( y6 s6 P! }* I( d( ^5 e% G
/ n1 Z; h2 w2 Y1 c21. 在语句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,则该行将被拒绝插入。
) P9 }3 P. T7 Y3 x2 X" C GA. 正确7 p2 o8 I, \5 H7 T/ B7 v
B. 错误5 x' S8 ]$ Z0 \* ?# Y
9 E1 B1 Y1 D3 s22. 创建一个DMS类型的表空间,可以使用以下哪两种文件系统对象作为容器?! v/ p& E) }4 C% }
A. 目录
- J2 T' d9 b4 u3 a6 @+ uB. 文件# l, M( |. w2 m* b+ t
C. DEVICE1 G g7 Z6 K' Q7 E3 r$ W
& n! w$ G n$ E7 a' `- r8 R23. 如果一个用户USER1被授予了表TAB上的CONTROL特权,如果需要限制该用户对表的存取,应使用以下哪条命令?+ r& m2 q& n$ o$ x$ ?9 k6 S
A. REVOKE ALL ON TAB TO USER1
) n$ p$ z/ X3 Y1 @& MB. REVOKE ALL ON TAB FROM USER1; M% s7 w8 f" y0 J! a9 q2 ^
C. REVOKE CONTROL ON TAB TO USER14 ^: i" I) c: \' u0 a
D. REVOKE CONTROL ON TAB FROM USER17 A5 c8 r- x3 b1 N. P* M
: \3 C% T/ }5 J9 \) R5 ^
24. 定义基本表时,若要求某一列的值不能为空,则应在定义时使用什么保留字?但如果该列是主键,则可省写。
% o) T6 H1 }3 n' _/ e; B8 G2 }; {4 AA. NULL
5 P! v# l5 X$ m& R8 r zB. NOT NULL% q+ q8 j' U2 ?4 X
C. DISTINCT6 V2 H2 T( g3 d" [8 @" G
D. UNIQUE6 z* ^) v: M2 z
, ?/ h# x7 }1 J+ x, X
25. 据库系统和文件系统的主要区别是:- a4 m# ^$ B& i- n# z& K$ M
A. 数据库系统复杂,而文件系统简单。
' a- a) q3 e! R" Z: Z/ n' c4 YB. 文件系统不能解决数据冗余和数据独立性问题,而数据库系统可以解决。
( k( T" f" W6 w3 ?0 p# f# ]* N' Z- sC. 文件系统只能管理程序文件,而数据库系统能够管理各种类型的文件。( f. s$ t4 F9 `# z3 |, z& S
D. 文件系统管理的数据量较少,而数据库系统可以管理庞大的数据量。( m3 Q- u4 x# L6 y6 X* I" x
0 e, \! I# d! s1 g9 z
! p6 ]+ d6 a; v3 Z2 o$ r4 W" I: E# H8 ]# g3 h7 r
" ^' x2 i% Z! o0 Z! Y
# p3 x$ `7 b4 `: b6 w& g8 p0 m Q- H& F& x: ?
3 b; U/ i% ?1 J
, D* h1 }4 X: `& k" R5 ~* M, y, P, b; I, R, p
K z1 m9 ?3 n& k' D3 y
; R8 q& Y+ z' q% A, e* W2 N: l$ T# ~$ a0 v
6 X- g6 Q7 S" }" `9 U
7 W1 v7 F6 t6 p5 ^
# P0 P7 H0 y' m8 L3 S
|
|