Giao trinh CSDL

Màu nền
Font chữ
Font size
Chiều cao dòng
is:

(a)

(c)

(d)

2.

2

3

4

5

None of the above

Which of the following functional dependencies must be FALSE ?

a)

c)

d)

X → Y ⇒ XZ → YZ

X → Y; YW → Z ⇒ XW→ Z.

X → Y, X → Z ⇒ X → YZ

X → Y; Z ⊆ Y ⇒ X → Z

None of the above

3.

Consider relation S(B, G, U, N, A) with the FD's: BG → U, G → N, NA→ B

What are all the keys of S ?

a) {B, G} and {N, A}

b) {U, A}

c) {G, A}

d) {B,N}

e) {B, G, U, N}

f)

4.

{B, G, A} and {G, N, A}

Which one of the following is correct?

(a)

(c)

(d)

All FDs must involve the attributes of the same relation.

All FDs must involve only a single attribute on the left side.

All FDs must involve only a single attribute on the right side.

All FDs must involve only single attributes on both sides.

None of the above

Biên soạn : Phan Tấn Quốc- Trường Cao Đẳng Kỹ Thuật Cao Thắng

Giáo Trình Cơ Sở Dữ Liệu

Trang 95

5.

Assume the relation R(A, B, C ,D, E) is in at least 3NF. Which of the following functional

dependencies must be FALSE?

a. A, B

b. A, B

c. C, D

C

D

E

d. None of the above

6.

SQL provides a number of special aggregate functions. Which one of the following is not

included in SQL?

(a) SUM

(b) MAX

(c) MIN

(d) COUNT

(e) MEDIAN

7.

Which of the following finds all groups meeting stated conditions?

(a) Select

(b) Where

(c) Find

(d) Having

8.

The ___________ clause is used to restrict the groups returned by a query.

(a) FROM

(b) WHERE

(c) HAVING

(d) GROUP BY

9.

To get all the customers from Hawaii sorted together, which of the following would be used?

(a) Order By

(b) Group By

(c) Having

(d) Sort

Biên soạn : Phan Tấn Quốc- Trường Cao Đẳng Kỹ Thuật Cao Thắng

Giáo Trình Cơ Sở Dữ Liệu

Trang 96

10. The ____ set operator will show all rows common to both tables A and B.

(a)

(c)

(d)

intersection

union

difference

product

11. Using the product operator, if table A has 2 rows and table B has 4 rows, the number of

rows in the product of these two tables is:

(a)

(c)

(d)

4.

8.

16.

20.

12. Suppose relation R(A,B,C,D,E) has the following functional dependencies:

A→B

B→C

BC → A

A→D

D→E

Which of the following is not a key?

(a)

(c)

(d)

A

E

B

D

(b) and (d)

13. Consider a relation Q with five attributes L V O B Y. You are given the follwoing

dependencies: L → V; VO → Y and YB → L.

The number of superkeys of Q is: (not superkeys)

(a).2

(b).3

(c),4

(d).5

Biên soạn : Phan Tấn Quốc- Trường Cao Đẳng Kỹ Thuật Cao Thắng

Giáo Trình Cơ Sở Dữ Liệu

Trang 97

14. Use the following tables and data,All of the fields are Integers.The table names are Q

A

1

1

2

2

5

B

2

3

3

4

6

C

3

5

4

6

7

D

4

7

5

8

8

How many records does the following SQL example return?

SELECT * FROM Q WHERE A>=5 OR D>=7;

a) 1

b) 2

c) 3

d) 4

15. How many records does the following SQL example return?

SELECT sum(A) AS S FROM Q GROUP BY A;

a)

S

11

S

1

1

2

2

5

c)

S

4

7

6

3

5

d)

S

None of the above

16. The SQL below will return one value. What is it?

SELECT sum(A) AS S FROM Q GROUP BY A HAVING count(A)>1;

a)

S

2

4

S

9

c)

S

2

2

d)

S

None of the above

Biên soạn : Phan Tấn Quốc- Trường Cao Đẳng Kỹ Thuật Cao Thắng

Giáo Trình Cơ Sở Dữ Liệu

Trang 98

5

17. How many records does the following SQL example return?

SELECT count(*) FROM Q GROUP BY A, B;

a) 2

b) 3

c) 4

d) 6

e) None of the above

18. Use the following tables and data..All of the fields are Integers.The table names are R and

S

R

A

6

4

S

C

8

3

6

D

4

5

2

E

2

7

9

B

7

2

How many records does the following SQL example return?

SELECT COUNT(*) FROM R, S WHERE R.A=S.D OR R.B=S.E;

a) 1

b) 2

c) 3

d) 4

19. How many records does the following SQL example return?

SELECT COUNT(*) FROM R, S WHERE R.A=S.D;

a) 0

b) 1

Biên soạn : Phan Tấn Quốc- Trường Cao Đẳng Kỹ Thuật Cao Thắng

Giáo Trình Cơ Sở Dữ Liệu

Trang 99

c) 2

d) 4

20. Which of the following statements contains an error?

(a) SELECT * FROM emp WHERE empid = 493945;

(b) SELECT empid FROM emp WHERE empid= 493945;

(c) SELECT empid FROM emp;

(d) SELECT empid WHERE empid = 56949 AND lastname = 'SMITH';

21. Which of the following statements will return the names of the products with Product ID 10,

11, or 42?

(a) SELECT ProductName FROM products WHERE ProductID IN (10,11,42)

(b) SELECT ProductName FROM products WHERE ProductID IN 10 OR 11 OR 42

(c) SELECT ProductName FROM products WHERE ProductID = (10,11,42)

(d) SELECT ProductName FROM products WHERE ProductID IS (10,11,42)

(e) None of the above

22. Which of the following commands will return the list of product names sorted in ascending

alphabetic order?

(a) SELECT ProductName FROM products ORDER BY ProductName DESC

(b) SELECT ProductName FROM products ORDER BY ProductName ASC

(c) SELECT ProductName FROM products SORTED BY ProductName ASC

(d) SELECT ProductName FROM products SORTED BY ProductName DESC

(e) None of the above

23. Which of the following will return a list of every product ID currently listed in the

order_details table where each product ID is listed only once?

(a) SELECT DISTINCT ProductID FROM order_details

(b) SELECT ProductID FROM order_details ONLY ONCE

(c) SELECT ProductID FROM order_details

(d) SELECT UNIQUE ProductID FROM order_details

(e) None of the above

24. In the instance of the relation R(A,O,T,V,U) shown below, which of the following functional

dependencies hold ?

Biên soạn : Phan Tấn Quốc- Trường Cao Đẳng Kỹ Thuật Cao Thắng

Giáo Trình Cơ Sở Dữ Liệu

Trang 100

AOTVU

12345

14345

12441

a) A O → T; V U → A

b) O → V; A V → U

c) T → O; A V → U

d) A O → T

e) O → V; V U → A

25. Which of the following statements contains an error?

(a)

(c)

(d)

SELECT cid, sum (qty) from orders group by cid having sum(dollars) > 2000;

SELECT aid, avg (qty) from orders group by aid;

SELECT cid, sum (dollars) from orders;

SELECT count (*) from orders;

26. Which code lists employees by descending order of salary

(a) SELECT * FROM EMPLOYEES SORT BY SALARY DESCENDING;

(b) SELECT * FROM EMPLOYEES IN ORDER OF SALARY;

(c) SELECT * FROM EMPLOYEES ORDER BY SALARY DESC;

(d) SELECT * FROM EMPLOYEES ORDER BY SALARY;

27. In order to perform a join, which criteria must be true?

(a) The two tables must have only one column exact same columns.

(b) The tables in the join need to have common rows.

(c) The two tables must both have primary keys

(d) The two tables must have a common column.

28. Consider the follow attributes and functional dependencies:

ABC

AB→ C

C→A

List all keys (not superkeys):

29. What will result from the following SQL Select statement?

Biên soạn : Phan Tấn Quốc- Trường Cao Đẳng Kỹ Thuật Cao Thắng

Giáo Trình Cơ Sở Dữ Liệu

Trang 101

Select min(product_description)

from product_v;

(a) The minimum value of product_description will be displayed.

(b) An error message will be generated.

(c) The first product description alphabetically in product_v will be shown.

(d) none of the above

30. The following two SQL statements will produce the same results:

Select last_name, first_name

from customer

where credit_limit > 99 and credit_limit < 10001;

Select last_name, first_name

from customer

where credit_limit between 100 and 10000;

a.TRUE

b.FALSE

31. The following query will execute without errors:

select customer.customer_name, salesman.sales_quota

from customer

where customer.salesman_id =

(select salesman_id

from salesman

where lname = 'SMITH');

a.TRUE

b.FALSE

32. Table TT {J , D , C , V , N , G } and a set of functional dependencies

J,C,N → V,G

D → C,V,G

J → D,C,G

The closure of {D } is:

Biên soạn : Phan Tấn Quốc- Trường Cao Đẳng Kỹ Thuật Cao Thắng

Giáo Trình Cơ Sở Dữ Liệu

Trang 102

a) J D C V N G

b) J D C V G

c) J C V G

d) D C V N

e) D C V G

33. Table TT {O , M , Z , I , Q } and a set of functional dependencies

O → I,Q

I → M,Z

O,Z → M

Table TT is:

a) 1 NF

b) 2 NF

c) 3 NF

34. For which task in SQL would you use an IN clause

(a) To query the database for unknown values

(b) To query the database for a range of values

(c) To query the database for a character pattern

(d) To query the database for values in a specified list

35. A Cartesian product is

(a) A group function

(b) Produced as a result of a join select statement with no where clause

(c) The result of fuzzy logic

(d) A special feature of Oracle Server

36. A type of query that is placed within a WHERE or HAVING clause of another query is called

a:

(a) master query.

(b) subquery.

(c) superquery.

(d) multi-query.

37. In order to perform a join, which criteria must be true?

Biên soạn : Phan Tấn Quốc- Trường Cao Đẳng Kỹ Thuật Cao Thắng

Giáo Trình Cơ Sở Dữ Liệu

Trang 103

(a) The two tables must have the exact same columns.

(b) The tables in the join need to have common rows.

(c) The two tables must both have primary keys

(d) The two tables must have at least one common column.

38. An attribute(s) which uniquely determines a tuple within a relation is called a:

(a) Candidate key

(b) Foreign key

(c) Primary key

(d) All of the above

(e) A and C

39. Table Q(A,B,C) and a set of functional dependencies

AB → C;

C → A;

Table Q is:

a) 1 NF

b) 2 NF

c)

3 NF

d) BCNF

40. Table Q(A,B,C,D) and a set of functional dependencies

AB → C;

D → B;

C → AD

Table Q is:

a) 1 NF

e) 2 NF

f)

3 NF

g) BCNF

41. The following table and functional dependencies exhibits what type of dependency?

Table(A, B, C)

Biên soạn : Phan Tấn Quốc- Trường Cao Đẳng Kỹ Thuật Cao Thắng

Giáo Trình Cơ Sở Dữ Liệu

Trang 104

A

A

B

C

B

C

Partial Dependence

Transitive Dependence

Full Dependence

A and B

None of the above

(a)

(c)

(d)

42. In the instance of the relation R(A,B,C,D,E) shown below, which of the following functional

dependencies (FD's) hold? Briefly justify your answer.

A

1

1

1

I. AB

C

I only

II only

I and III only

II and III only

II. B

D

B

2

4

2

C

3

3

4

D

4

4

4

III. DE

E

5

5

1

B

(a)

(c)

(d)

43. Table Q{A , B , C , D} and a set of functional dependencies

A → B, C

D→C

The closure of {A D } is:

a) A D

b) A D B C

c) B C

d) None of the above

44. Consider the relation student(sno, sname, cname, cno) where (sno, cno) or (sname,

cname) are candidate keys. There are functional dependencies within the keys.

Biên soạn : Phan Tấn Quốc- Trường Cao Đẳng Kỹ Thuật Cao Thắng

Giáo Trình Cơ Sở Dữ Liệu

Trang 105

The highest normal form whose requirements this relation satisfies is:

(a)

(c)

(d)

1NF

2NF

3NF

BCNF

45. Let R be a relation with attributes (B,I,N,R,U,L) and let the following functional

dependencies hold.

B

→I

B →N

NR

NR

I →U

Given the above functional dependencies, which of the following functional dependencies does

not hold:

a) N R → U L

b) B R → L

c)

B→U

→U

→L

d) I→ N R

46. Suppose relation R(S,G,F,Y,N) has the following functional dependencies:

S →G

G →F

GF

→S

S →Y

N →S

Y →N

Which of the following is not a key?

a) N

c) S

b) G,F

d) Y

47. Table TT {A , N , H , K , J , O , X } and a set of functional dependencies

A, N → O, X

Biên soạn : Phan Tấn Quốc- Trường Cao Đẳng Kỹ Thuật Cao Thắng

Giáo Trình Cơ Sở Dữ Liệu

Trang 106

J → A , N, H

H, O → K, X

H, K, X → O

A, N, X → J

The closure of {A N } is:

e) A H K X J O

f)

ANHKXJ

g) A N H X J O

h) A N H K X J O

48. Consider the follow attributes and functional dependencies:

ABCDEFH

A→ D

AE → H

DF → BC

E→C

H→E

List all keys (not superkeys):

49. (Đề 48) Consider the decomposition into 3 relations: (AD) (EC) (ABEFH). Is this

decomposition in

(a)

(c)

(d)

BCNF

3NF

1NF

None of the above

50. Consider a relation R(A,B,C) with the following functional dependencies:

A → B;B → C and B → A

The number of superkeys of R is:

(a)

(c)

(d)

2

3

5

6

Biên soạn : Phan Tấn Quốc- Trường Cao Đẳng Kỹ Thuật Cao Thắng

Giáo Trình Cơ Sở Dữ Liệu

Trang 107

TRƯỜNG CĐ KỸ THUẬTCAO THẮNG

KHOA ĐT-TH

ĐỀ THI MÔN CƠ SỞ DỮ LIỆU

thời gian làm bài 90 phút

CÂU I:(5đ)

Sau đây là một số lược đồ quan hệ được trích từ bài toán quản lý tuyển sinh:

ĐIEMTHI(ĐIEMTHISO,ĐIACHIDIEMTHI)

Một hội đồng coi thi tuyển sinh có nhiều điểm thi, mỗi điểm thi được đặt tại một trường

nào đó. Các điểm thi (ĐIEMTHISO) được đánh số là điểm thi số 1, điểm thi số 2, điểm thi số

3,...Mỗi điểm thi xác định địa chỉ (ĐIACHIDIEMTHI).

THISINH(SOBD,HOTEN,NGAYSINH, PHAI, ĐIACHI, MANGANH, PHONGTHI)

Mỗi thí sinh có một số báo danh (SOBD) duy nhất, mỗi số báo danh xác định các thông

tin: họ và tên (HOTEN), ngày sinh (NGAYSINH), phái (PHAI), địa chỉ thường trú (ĐIACHI), mã

ngành đăng ký thi(MANGANH), số hiệu phòng thi(PHONGTHI).

NGANH(MANGANH,TENNGANH)

Mỗi ngành có một mã ngành (MANGANH) duy nhất, mỗi mã ngành xác định tên ngành

(TENNGANH), chẳng hạn ngành Công Nghệ Thông Tin có mã ngành là 01, ngành Công Nghệ

Hoá Thực Phẩm có mã ngành là 10,...

PHONG(PHONGTHI,ĐIEMTHISO)

Mỗi điểm thi có nhiều phòng thi (PHONGTHI) được đánh số hiệu khác nhau ở tất cả

các điểm thi (trong một phòng thi có thể có các thí sinh của nhiều ngành khác nhau)

1.Xác định khoá cho mỗi lược đồ quan hệ trên (1 điểm)

2.Hãy xác định các ràng buộc toàn vẹn có trong lược đồ cơ sở dữ liệu trên (mỗi loại

cho một ví dụ) (1 điểm)

3.Thực hiện các yêu cầu sau bằng SQL (3 điểm)

a.Lập danh sách các thí sinh đăng ký dự thi có số hiệu phòng là "0061", danh sách cần:

SOBD,HOTEN,TENNGANH và được sắp tăng dần theo cột SOBD.

b.Danh sách các thí sinh đã đăng ký thi vào ngành có mã ngành là "01", danh sách cần:

SOBD, HOTEN, NGAYSINH, PHONGTHI, ĐIACHIDIEMTHI và được sắp tăng dần theo cột

SOBD.

c.Hãy thống kê xem mỗi ngành có bao nhiêu thí sinh đã đăng ký thi, danh sách cần:

MANGANH,TENNGANH, SOLUONG, trong đó số lượng(SOLUONG) là thuộc tính tự đặt..

Biên soạn : Phan Tấn Quốc- Trường Cao Đẳng Kỹ Thuật Cao Thắng

Giáo Trình Cơ Sở Dữ Liệu

Trang 108

CÂU II: (2đ)

1.Cho lược đồ quan hệ Q(ABCD), r và s là hai quan hệ được cho như sau:

A

1

1

1

1

Tìm

B

0

1

1

1

r-s

r*s

C

0

0

1

1

D

0

0

0

1

A

2

2

1

x

B

1

2

1

y

C

1

1

1

z

D

1

1

0

v

2.Cho hai lược đồ quan hệ Q1(ABC) và Q2(DEF), r và s là hai quan hệ được cho như sau:

A

1

a

x

B

2

y

A =D

C

3

c

z

D

1

a

5

E

6

F

f

f

7

Tìm

r |><| s

3.Cho hai lược đồ quan hệ Q1(ABC) và Q2(DE), r và s là hai quan hệ được cho như sau

A

1

4

7

B

2

5

8

B>D

C

3

6

9

D

3

6

E

1

2

Tìm r |><| s

4.Cho hai lược đồ quan hệ Q1(ABCD) và Q2(CD), r và s là hai quan hệ được cho như sau:

A

a

B

C

c

D

d

C

c

D

d

Biên soạn : Phan Tấn Quốc- Trường Cao Đẳng Kỹ Thuật Cao Thắng

Giáo Trình Cơ Sở Dữ Liệu

Trang 109

a

c

a

c

d

d

f

f

f

f

Tính r ÷ s

CÂU III (1đ)

1)Cho lược đồ quan hệ Q(ABCDE), r là một quan hệ được cho như sau:

A

1

1

1

B

2

4

2

C

3

3

4

D

4

4

4

E

5

5

1

Những phụ thuộc hàm nào sau đây thoả r ?

C → B;

AD → E ;

B → D;

AB → C.

AC → D

2.Cho lược đồ quan hệ Q(ABCD) và tập phụ thuộc hàm F = {A → B ; BC→D}.

Những phụ thuộc hàm nào sau đây thuộc F+ ?

C → D; A → D; AD → C; AC → D; BC → A; B → CD.

CÂU IV (2đ)

1.Cho lược đồ quan hệ Q và tập phụ thuộc hàm F, K ⊆ Q+. Hãy nêu điều kiện để K là khoá của

Q.

2.Cho lược đồ quan hệ Q(ABCD) và tập phụ thuộc hàm F={A → D; D → A; AB→C}

a.Tính AC+

b.Tìm tất cả các khoá của Q.

c. Q đạt dạng chuẩn nào ? giải thích.

Hết

(Sinh viên không được sử dụng tài liệu

cán bộ coi thi không giải thích gì thêm

Biên soạn : Phan Tấn Quốc- Trường Cao Đẳng Kỹ Thuật Cao Thắng

Giáo Trình Cơ Sở Dữ

Bạn đang đọc truyện trên: Truyen2U.Net

#science