2009年南京理工数据库考题db2009a

  • 格式:doc
  • 大小:124.00 KB
  • 文档页数:10
南京理工大学课程考试试卷 课程名称:
试卷编号: 组卷日期: 学生班级:
(学生考试用)
数据库系统(英)
A
学分: 3
大纲编号
06022505
考试方式: 闭卷 满分分值: 70 考试时间: 120 分钟 组卷教师(签字) : 学生学号: 审定人(签字) : 学生姓名:
2010 年 1 月 20 日
说明:1.所有答案做在答卷纸上,并请标明题号 2.考试完毕后连考卷一起交上 Question 1 (20 points, 1 per part) 1. If a product can be manufactured in many plants, and a plant can manufacture many products, this is an example of which type of relationship from products to plants? A) Many-many B) Many-one C) One-one D) One-many 2. If we use the “E/R” approach of converting the following E/R diagram to relations, which of the following would be one of the relation schemas we construct? d isa f B A) B(d,e,f) B) C(g,e) C C) A(d,f,g) D) B(d,f) e isa g
SELECT grade,COUNT(*) FROM G GROUP BY grade; How many tuples are returned? A) 1 B) 2 C) 3
D) 4
13. In the 3-valued logic, the value of expression R.a>=R.b OR R.a<=0 OR R.b>=0 can be: A) Only TRUE or FALSE B) Only FALSE or UNKNOWN C) Only TRUE or UNKNOWN D) Any of TRUE, FALSE, or UNKNOWN 14. Unique constraints: A) Require columns that have NOT NULL constraints B) May only be defined once per table C) May be violated by a insertion D) Are identical to primary key constraints
5. Suppose the relation R(A,B,C) has the following four tuples: A 3 4 3 4 B 1 1 1 1 C 2 2 4 4
Which of the following functional dependencies can you infer does not hold in R? A) A->B B) BC->A C) C->B D) AB->A The following two questions refer to a relation R(A, B, C, D,E) with functional dependencies ABC->DE, and D->AB. 6. Which of the following is the highest normal form of R? A) 1NF B) 2NF C) 3NF D) BCNF 7. The number of superkeys of R is: A) 2 B) 7 C) 10
第 2 页
15. Suppose we have the following table declarations: CREATE TABLE A(w INT PRIMARY KEY); CREATE TABLE B(x INT PRIMARY KEY REFERENCES A(w) ON DELETE SET NULL); CREATE TABLE C(y INT REFERENCES A(w)); CREATE TABLE D(z1 INT REFERENCES B(x) ON DELETE SET NULL, z2 INT REFERENCES A(w) ON UPDATE CASCADE); Consider the following operations: I. DELETE FROM C; DELETE FROM B; DELETE FROM A; DELETE FROM D; II. DELETE FROM C; DELETE FROM D; DELETE FROM A; DELETE FROM B; III. DELETE FROM B; DELETE FROM C; DELETE FROM D; DELETE FROM A; Which of the above operations will empty all four tables without error? A) III only B) I only C) II and III only D) I and III only The following two questions concern the relations: Emps (id, name, dept, salary) Managers (dept, mgr) The first gives the employee ID, their name, department, and salary; the second gives for each department, the manager of that department, which is the employee ID of the person managing the department. 16. We wish to constrain the relations so that in the mgr attribute of a Managers tuple there must appear the ID of an employee in Emps. Which of the following changes, by itself, enforces that constraint? A) In the declaration of Managers, add for attribute mgr the attribute-based check CHECK(EXISTS(SELECT * FROM Emps WHERE id=mgr)). B) In the declaration of Emps, add the constraint FOREIGN KEY id REFERENCES Managers(mgr). C) In the declaration of Managers, add the constraint FOREIGN KEY mgr REFERENCES emps(id). D) More than one of the above. 17. Suppose we wish to constrain the data so that in no department can the employees have a total salary greater than $1,000,000. The following is a framework for an assertion that will enforce this constraint: CREATE ASSERTION cheap CHECK(NOT EXISTS(Q)); Which query Q best enforces this constraint?
in the answer to Q2. in the answer to Q1.
10. In A) May B) May C) May D) May
SQL, an be used be used be used be used
ALTER statement: to add a view. to add a constraint. to drop a table. to drop a view.
A
3. Which of the following four expressions of relational algebra is not equivalent to the other three? They are all based on the relations R(A,B) and S(B,C). A) A, B R S B) R B S C) R A R B S D) A, R.B R S

4. Assume R and S are each relations with attributes a and b only. Q1: a R a S Q2: a R S Which of the following is correct? 第 1 页
A) B) C) D)
11. In SQL, an UPDATE statement without a WHERE clause: A) Results in a Cartesian product. B) Updates no rows in a table. C) Updates every column in a table. D) Updates every row in a table. 12. Consider relation 'G' and the query given below: student 1 2 3 4 grade A NULL B A