上海交通大学 数据库原理 陆朝俊 复习

更新时间:2023-09-21 17:39:01 阅读量: 工程科技 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

ER

b a c R F E d isa e G S H h f g If we translate this diagram to relations in the normal way for E/R diagrams described in the textbook, which relation schema would not be in the resulting database schema? (A) E(a,c,b) (B) S(a,c,f,g) (C) F(c,d) (D) R(a,c)

If we instead used the “object-oriented” approach to translating this E/R diagram to relations, how many relation schema would be different (when compared to the E/R-to-relations translation), either in their schema, or their set of tuples, or both? (A) 1 (B) 2 (C) 3 (D) 4

1 of 9

Convert the following E/R diagram (with details omitted) to a relational database schema using the object-oriented method. How many relation schemas will be produced? (Assume that each entity set has its own special attributes.)

A isa B isa D

(A) 1

isa C

(B) 4

(C) 5 2 of 9

(D) 6

Relational Theory

Given a relation R(A,B,C,D,E) and FDs AB?CE, B?D, and D?E, which of the following FD’s can not be inferred? (A) AD?CE (B) BC?D (C) AB?A (D) B?E

Given a relation R(A,B,C,D) with FD: A?BC, which of the following MVD’s can not be inferred? (A) A??BC (B) A??B (C) A??BD

(D) None of the above.

Suppose we have a relation R(A,B,C,D,E) and the FD’s A?DE, D?B, and E?C. If we project R (and therefore its FD’s) onto schema S(A,B,C), what is true about the key(s) for S? (A) Only ABC is a key (B) Only A is a key (C) Only DE is a key

(D) A, B, and C are each keys

Suppose we are given a relation schema R(A,B,C,D,E) with functional dependencies A?B, BC?D and E?C. If we project R onto S(B,C,D,E), which of the following functional

dependencies holds in S and is not a BCNF violation for S? (A) BC?D (B) BE?D (C) B?E (D) E?C

Suppose that R(A,B,C,D) satisfies MVD:A??B and it is known that R has tuples (a1,b1,c1,d1), (a1,b2,c2,d2), and (a2,b1,c1,d2). How many tuples must R have at least? (A) 3 (B) 4 (C) 5 (D) 6

3 of 9

Relational algebra and Datalog

In the following question, assume R and S are bags, and the operators are bag operators. Q1: (R∪ S) – (R∩S) Q2: (S–R) ∪ (R–S)

(A) Q1 and Q2 produce the same answer.

(B) The answer to Q1 is always contained in the answer to Q2. (C) The answer to Q2 is always contained in the answer to Q1. (D) Q1 and Q2 produce different answers.

Given relations P(A,B,C) and Q(C,D), which of the following relational algebra expressions is equivalent to this Datalog rule:

Answer(x,w) ? P(x,y,z) AND Q(y,w) AND x

(A) ?P.A,Q.D(?P.A

(D) ?P.A,Q.D(?P.A

4 of 9

SQL

Q1: SELECT DISTINCT a FROM R WHERE b > 10; Q2: SELECT a FROM R WHERE b > 10 GROUP BY a; (A) Q1 and Q2 produce the same answer.

(B) The answer to Q1 is always contained in the answer to Q2. (C) The answer to Q2 is always contained in the answer to Q1. (D) Q1 and Q2 produce different answers.

Consider the following two SQL queries on relations R(a,b) and S(c):

Q1: SELECT a FROM R

WHERE b > ALL (SELECT c FROM S); Q2: SELECT a FROM R

WHERE b > ANY (SELECT c FROM S); (A) Q1 and Q2 always produce the same answer.

(B) The answer to Q1 is always contained in the answer to Q2. (C) The answer to Q2 is always contained in the answer to Q1. (D) None of the above.

Given R(A,B)={('a',10),('b',20),('c',30)}, and execute the following three statements. What is the result of the last statement?

create view V as select A from R where B>10; insert into V values('d'); select count(*) from V; (A) 1 (B) 2 (C) 3 (D) 4

5 of 9

本文来源:https://www.bwwdw.com/article/ia3h.html

Top