吉大17春秋学期《数据库应用技术》在线作业一
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
一、单选题(共 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
A. 0
B. 1
C. 3
D. 4
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?
A. 0
B. 3
C. 4
D. 5
3. How many rows can be retrieved using a single SELECT INTO statement?
A. Only one row
B. As many as are in the result
C. As many as are host variables used in the call
D. As many as host variable array structures can hold
4. 实体是信息世界中的术语,与之对应的数据库术语为:()
A. 文件
B. 数据库
C. 字段
D. 记录
5. 如果开发人员在AIX操作系统上开发访问后台AS400上的DB2数据库,则需要在AIX开发环境中安装:()
A. DB2个人开发版(PDE)
B. DB2通用开发版(UDE)
6. 关系模型中的关系模式至少是()
A. 1NF
B. 2NF
C. 3NF
D. BCNF
7. 若用如下的SQL语句创建一个student表: CREATE TABLE student(NO CHAR(4) NOT NULL,NAME CHAR(8) NOT NULL, SEX CHAR(2), AGE NUMBERIC(2))可以插入到student表中的是哪一项?
A. (‘1031’,‘曾华’,男,23)
B. (‘1031’,‘曾华’,NULL,NULL)
C. (NULL,‘曾华’,‘男’,‘23’)
D. (‘1031’,NULL,‘男’,23)
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上有几个索引?
A. 0
B. 1
C. 2
D. 3
E. 4
9. Given the code: EXEC SQL WITH most_cities AS ( SELECT b.id, , 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?
A. The current statement
B. Statements from any application
C. All statements within this application
D. All statements within the current unit of work
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?
A. FOO requires EXECUTE privilege on the package.
B. FOO requires the privilege to create the package on the remote DB2 server.
C. FOO requires EXECUTE privilege on the package and INSERT privilege on CUST.ORDERS.
D. FOO requires the privilege to create the package on the remote DB2 server and INSERT privilege on CUST.ORDERS.
11. 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 )