
















Preview text:
  lOMoAR cPSD| 58605085 ASSIGNMENT 2    1. 
Which of the following representations is a relational schema?  a.  Q(A, B, C)  b.  Q A, B, C  c.  Q{A, B, C}  d.  All are correct  2. 
What is the superkey of a relational schema Q(R)? 
‒ R is the superkey of the relation schema Q  3. 
There is only one super key in a relation. True or false? 
‒ False, there can be many super keys in a relation  4. 
A superkey in a relation can include more than the number of 
attributes in a relation. True or false? 
‒ False, a super key in a relation can have at most as many attributes as the 
number of attributes in a relation  5. 
Which statement below is incorrect: 
a. The number of attributes in the super key is a subset of the attribute set in  therelation 
b. The parent set of a super key is also the super key 
c. Any subset of a superkey is also a superkey 
d. All 3 statements are correct 
6. Let Q(A, B, C, D, E) have super key {A, B, C}. Which statement below is  false:      lOMoAR cPSD| 58605085 a.  {A, B, C, D} is superkey  b.  {A, B, C, D, E} is superkey  c.  Both a and b are correct  d. 
Both a and b are incorrect    7. 
Which of the following is true 
a. A candidate key is a key that can be chosen as the primary key for a  relation 
b. Each relation has only one candidate key  c. Both a and b are correct  d. a and b are incorrect  8. 
What is the primary key of a relation? 
‒ One of the candidate keys will be chosen as the primary key for the relation  9. 
Each relation has only 1 primary key. True or false?  ‒ True 
10. Given Q1(A, B, C) and Q2(D, A). Which of the following statements is  correct 
a. Attribute Q2.A is a foreign key in Q2 
b. Q1 is called the referenced relation and Q2 is called the reference relation 
c. Attribute Q2.A references Q1.A 
d. All 3 statements are correct 
11. Given Q1(A, B, C) and Q2(D, B). Which of the following statements is  correct      lOMoAR cPSD| 58605085
a. Q2.B can be a foreign key referencing Q1.B if Q1.B has a unique constraint 
b. Q2.B is a foreign key that references Q1.B if Q1.B has the 
notnulldsafdasfdsafdsafdsafed constraint 
c. Both sentences a and b are correct 
d. Both sentences a and b are incorrect   
12. Which statement below is correct? 
a. Foreign keys in the relationfdsal model represent an association between  tworelations 
b. Foreign key constraints are also called referential constraints 
c. A relation may not have foreign keys 
d. A relation can have many foreign keys 
e. All are correctfdsafdsafd 
13. Explain the semantic referential constraint between Q1(A, B, C) and  Q2(D, A) fdsadsaf 
‒ Attribute Q2.A is a foreign key in Q2dsafdsafdsaelation and Q2 is called the  reference relation 
‒ Attribute Q2.A is referenced through Q1.A 
14. Is the value domain of a semafdsafdsafdsantic attribute a constraint 
imposed on the data of that attribute?  ‒ True 
15. The following symbols |Sex|, Dom(Sex), MGT(Sex) which symbol is the 
value domain symbol of the Sex attribute. 
‒ The value domain symbol of the Sex attribute is: Dom(Sex) = |Sex|      lOMoAR cPSD| 58605085
16. Let NV(MaNV, Hoten, Phao Sinh) and PB(MaPB, TenPB, Matrph). 
Regulation: each department has 1 employee as the department  fdsafdasfdsa        lOMoAR cPSD| 58605085 Chap 3 
1. Presents the syntax of selection according to condition F σF 
2. Let Q(A, B, C, D). Which of the following F-conditional expressions is  incorrect and why? 
a. A = C, D > 5 false cause of “,”  b. A = C and D > 5  c. A = C D > 5 
d. A = C ; D > 5 false cause of “;” 
3. Let Q(A, B, C, D). Which expression is syntactically incorrect in the 
following relational algebra expressions and why? 
a. A=B D > 5:Q false cause of “:”  b. A=B D > 5(Q) 
4. Let SV(MaSV, Hoten, Ngaysinh, khoa, DiemTB). 
What does the expression khoa = ‘CNTT’ DiemTB >=8(SV) do? 
Execute the command to select students of the IT department with an  average score of 8 or higher 
5. Let Q(A: string, B: string, C: int, D: int). Which of the following expressions  is incorrect and why? 
a. A B, C>5(Q) – False cause it have “^” 
b. A,B,sum(C)(Q) – false cause the sum function is only used in function F c.  A, B, C* 5(Q) 
6. Let Q(A: string, B: string, C: int, D: int). Which of the following expressions  is incorrect and why? 
a. A,B,D( A, B, C(Q)) – False because the selection conditions are unclear 
b. A=B,D >5( A, B, C(Q)) – False cause it have “,”      lOMoAR cPSD| 58605085
c. A=B and D >5( A, B, C(Q)) – False cause projection does not have attribute D 
7. Let Q(A: string, B: string, C: int, D: int). Which of the following expressions  is incorrect and why? 
a. A, B, C A=B and D >5(Q) – False cause missing “(“ and “)” 
b. A, B, C( A=B and D >5(Q) – False cause missing “)” 
c. A and B and C( A=B and D >5(Q) – False cause missing ")" and not allowed to use  "and" but must use "," 
8. Let Q(A: string, B: string, C: int, D: int). Why is expression A=B,D >5 A, B, C(Q)  incorrect? 
Wrong sign "," and missing “( )” around function π 
9. Let Q(A: string, B: string, C: int, D: int). Which of the following expressions 
meets the requirements correctly: Make a list with 3 columns A, B, D and  rows that satisfy C = D.  a. C = D(Q)  b. C = D( A,C,D(Q))  c. A,B,D( C = D(Q))  d. C = D( A,B,C,D(Q)) 
10.Which of the following expressions renames the relation Q to R?  a. FQ(R)  b. R(Q)  c. Q(R)  d. FR(Q) 
11.Which statement below is false? 
a. The rename operation creates a new relation with a new name from the  input relation      lOMoAR cPSD| 58605085
b. It is possible to both rename the relationship and rename the attributes of  the input relationship 
c. After renaming, we can no longer use the input relationship with the  old name 
12.Let Q(A, B, C, D) and expression R(A, B, E, D)(Q). Which statement below is  correct? 
a. The implementation expression renames the relation Q to R and keeps  the attribute names the same 
b. The implementation expression renames attribute C to E and keeps the  relationship name intact 
c. The implementation expression renames relation Q to R and renames  attribute C to E  d. All are correct 
13.Aggregate function included 
a. Functions sum, max, min, avg, count 
b. Functions sum, max, min, avg, count, sort 
c. Functions sum, max, min, avg, count, find 
d. Functions sum, max, min, avg, count, sqrt 
14.Which expression below is correct? 
a. Fham(thuộc_tính)(Quan hệ) 
b. Thuộc_tính_gom_nhómFham(thuộc_tính)(Quan hệ) 
c. Thuộc_tính_gom_nhómFham(thuộc_tính) as tên_mới(Quan hệ)  d. All are correct  15.The aggregate function is 
a. The function takes in a set of values and returns 1 value 
b. The function takes in a set of values and returns a set of values      lOMoAR cPSD| 58605085
c. The function takes in a value and returns a set of values 
d. The function takes in 1 value and returns 1 value 
16.Which expression below is correct? 
a. Multiple aggregation functions can be used in one aggregation  function expression 
b. Only one function is allowed. 
c. Aggregate functions cannot be used in combination with the grouping  attribute  d. All are incorrect 
17.Cho Q(A: string, B: string, C: int, D: int). Biểu thức AFsum(C) Tong(Q) cho kết quả  là gì?  - 
A table that combines groups of attributes A to produce the total C 
18.Cho Q(A: string, B: string, C: int, D: int). Biểu thức nào dưới đây đúng  a. A,BFsum(A) Tong(Q) 
b. A,BFsum(D) Tong1, sum(C)(Q)  c. Fsum(A) Tong(Q)  d. All are correct 
19.F in the expression for calculating the aggregate function is read as  a. Upper F  b. Lower F  c. Script F  d. All are incorrect 
20.Cho SV(Hoten: string, Khoa: string, Hocbong: int, DiemTB: int). Biểu thức 
nào dưới đây thực hiện đếm số SV khoa CNTT 
a. Khoa = ‘CNTT’(KhoaFcount(*)(SV)) 
b. Fcount(*)( Khoa = ‘CNTT’(SV))      lOMoAR cPSD| 58605085
c. Khoa = ‘CNTT’(KhoaFcount(Hoten)(SV))  d. All are correct 
21.Cho Q(A: string, B: string, C: int, D: int). Biểu thức nào dưới đây sai và vì  sao?  a. A = ‘a’(Fsum(C)(SV))  b. A = ‘a’(BFsum(C)(SV))  c. A = ‘a’(AFsum(C)(SV)) 
22.Which of the following expressions performs assignment (Phép gán) in  relational algebra? 
a. Buf Khoa = ‘CNTT’(KhoaFcount(*)(SV)) 
b. Buf Khoa = ‘CNTT’(KhoaFcount(*)(SV)) 
c. Khoa = ‘CNTT’(KhoaFcount(*)(SV)) Buf 
d. Buf = Khoa = ‘CNTT’(KhoaFcount(*)(SV)) 
23.Two relations are said to satisfy association compatibility if 
a. Two relations have the same number of attributes 
b. Corresponding pairs of attributes in two relations must have the same value  domain 
c. Two relations have the same number of attributes and the same attribute  names 
d. Two relations have the same number of attributes and corresponding 
pairs of attributes in the two relations must have the same value domain 
24. Phát biểu nào dưới đây đúng 
a. Association can be performed with any two relations 
b. Union can be performed with two relations with the same number of degrees      lOMoAR cPSD| 58605085
c. Association can be performed with two relationships that satisfy 
association compatibility  d. All are incorrect 
25. Cho Q1(A: int, B: int, C:String) và Q2(A: int, B: int, C:String). Biểu thức nào  dưới đây đúng  a. Q1 Q2  b. A,B(Q1) A,B(Q2)  c. A = 5(Q1) Q2  d. All are correct 
26. Cho Q1(A: int, B: int, C:String) và Q2(A: int, B: int, C:String). Biểu thức  A = 5(Q1) A,B Q2 sai vì 
a. Missing parentheses ”( )” surrounding Q2 
b. The two result relations of the two operations selection and projection are not  compatible 
27. Phát biểu nào dưới đây đúng 
a. Intersection can be performed with two relations with the same number of  degrees 
b. Intersection can be performed with two relations with the same structure 
c. Intersection can be performed with any two relations  d. All are incorrect 
28. Cho Q1(A: int, B: int, C:String) và Q2(A: int, B: int, C:String). Biểu thức nào  dưới đây đúng  a. A = 5(Q1) Q2  b. A,B(Q1) A,B(Q2)      lOMoAR cPSD| 58605085 c. A = 5(Q1) C = ‘cc’(Q2)  d. All are correct 
29. Cho Q1(A: int, B: int, C:String) và Q2(A: int, B: int, C:String). Biểu thức 
( A = 5Q1) A,B Q2 sai vì sao?  Missing brackets Q1 and Q2 
30. Phát biểu nào dưới đây đúng 
a) Subtraction can be performed with two relations with the same number of  degrees 
b) Subtraction can be performed with two relations that are associatively  compatible 
c) Subtraction can be performed with any two relations  d) All are incorrect 
31. Cho Q1(A: int, B: int, C:String) và Q2(A: int, B: int, C:String). Biểu thức 
nào dưới đây đúng a. A = 5(Q1) - Q2  b. A,B(Q1) - A,B(Q2) 
c. A = 5(Q1) - C = ‘cc’(Q2)  d. All are correct 
32. Cho Q1(A: int, B: int, C:String) và Q2(A: int, B: int, C:String). Biểu thức 
A = 5(Q1) – ( A,B Q2) sai vì sao?  Q2 must be in parentheses 
33. Phát biểu nào dưới đây đúng 
a) Cartesian integration can be performed with two relations with the same  number of degrees 
b) Cartesian integration can be performed with two relations that are union  compatible 
c) Cartesian integration can be performed with any two relations      lOMoAR cPSD| 58605085 d) All are correct 
34. Cho Q1(A1, A2, …, An) có k bộ và Q2(B1, B2, …, Bm) có l bộ. Q1 x Q2 cho 
kết quả là một quan hệ mới 
a) Q(A1, A2, …, An, B1, B2, …, Bm) có k * l bộ 
b) Q(A1, A2, …, An, B1, B2, …, Bm) có k + l bộ 
c) Q(A1, A2, …, An) có k + l bộ 
d) Q(B1, B2, …, Bm) có k * l bộ 
35. Cho Q1(A: int, B: int, C:String) và Q2(A: int, B: int, C:String). Biểu thức nào  dưới đây đúng  a. A = 5(Q1) x Q2  b. A,B(Q1) x A,B(Q2) 
c. A = 5(Q1) x C = ‘cc’(Q2)  d. All are correct 
36. Cho Q1(A: int, B: int, C:String) và Q2(A: int, B: int, C:String). Biểu thức 
(A = 5)Q1 x ( A,B Q2) sai vì sao? 
Wrong parentheses in the “( A,B Q2)” statement because parentheses must  surround Q2 
37. Cho SV(MaSV, Hoten, Ngaysinh) và Dangky(MaSV, Hoten, MaMH). Biểu 
thức nào dưới đây cho kết quả là danh sách SV chưa đăng ký môn học. 
a. MaSV, Hoten (SV – Dangky) 
b. MaSV, Hoten (SV) – MaSV, Hoten (Dangky) 
c. MaSV, Hoten (SV) MaSV, Hoten (Dangky) 
d. MaSV, Hoten (SV) MaSV, Hoten (Dangky)      lOMoAR cPSD| 58605085
38. Cho Q1(A, B, C) và Q2(A, B, D). Biểu thức nào dưới đây cho kết quả giống 
với kết quả của biểu thức A, B(Q1) – ( A, B(Q1) A, B(Q2)).  a. A, B(Q1) - A, B(Q2) 
b. A, B(Q1) ( A, B(Q1) - A, B(Q2)) 
c. Both a and b are correct  d. Both a and b are incorrect 
39. Cho R(A1, A2, ..., An), S(B1, B2, ..., Bm). Phát biểu nào dưới đây đúng 
a. The combination R and S according to condition is written in syntax:  R |X| S 
b. The condition in the combination R and S according to condition has the 
form R.A S.B with being the comparison operator in which R.A and S.B 
must have the same value range.  c. Both a and b are incorrect 
d. Both a and b are correct 
40. Thực hiện phép kết theo điều kiện giữa 2 quan hệ Q1 và Q2 tương đương  với 
a. Perform the Cartesian product between Q1 and Q2, then perform the 
selection according to the condition in the result relation in the previous  step 
b. Perform the selection according to condition in Q1 and Q2, then perform  the Cartesian product  c. Both a and b are incorrect      lOMoAR cPSD| 58605085
d. Both a and b are correct 
41. Cho Q1(A, B, C) và Q2(A, E, D). Biểu thức nào dưới đây tương đương với 
biểu thức Q1 |X|Q1.A > Q2.A Q2 
a. Q1.A > Q2.A (Q1 x Q2) 
b.  Q1.A > Q2.A (Q1 Q2) 
c.  Q1.A > Q2.A (Q1 Q2) 
42. Cho Q1(A, B, C) và Q2(A, E, D). Biểu thức nào dưới đây tương đương với  biểu thức   Q1 |X|Q1.A > Q2.A Q2 
a.  Q1.A > Q2.A (Q1) x Q1.A > Q2.A (Q2) 
b.  Q1.A > Q2.A (Q1) Q1.A > Q2.A (Q2) 
c.  Q1.A > Q2.A (Q1) Q1.A > Q2.A (Q2)  d. All are incorrect 
43. Cho Q1(A, B, C) và Q2(A, E, D). Biểu thức Q1.A > Q2.A Q1 x (Q1.A > Q2.A  Q2) sai 
44. Phát biểu nào dưới đây đúng 
a. Natural conjunction in relational algebra is a special case of conjunction  under condition 
b. The condition for natural union is equality comparison on the same 
attributes in the two relations you want to join 
c. The result of natural combination in relational algebra will be to remove  similar attributes.  d. All are correct      lOMoAR cPSD| 58605085
45. Cho Q1(A, B, C) và Q2(A, E, D). Biểu thức nào dưới đây cho kết quả giống 
như kết quả của biểu thức Q1 |X| Q2  a. Q1 |X|Q1.A = Q2.A Q2 
b. Q1.A,B,C,E,D(Q1 |X|Q1.A = Q2.A Q2) 
46. Cho Q1(A, B) và Q2(C, E, D). Giả sử A và C có cùng miền giá trị. Biểu thức  nào dưới đây đúng  a. Q1 |X| Q2  b. Q1 |X|A=C Q2 
47. Cho Q1(A, B, C) và Q2(A, B, D). Biểu thức nào dưới đây đúng  a. Q1 |X| Q2  
b. Q1 |X|Q1.A > Q2. A Q2 
c. Both a and b are correct 
48. Cho Q1(A, B, C) và Q2(A, B, D). Biểu thức nào dưới đây cho kết quả giống 
như kết quả của biểu thức Q1 |X| Q2 
a. Q1 |X| Q2, với : Q1.A=Q2.A Q1.B = Q2.B 
b. A,B,C,D(Q1 |X| Q2), với : Q1.A=Q2.A Q1.B = Q2.B 
49. Cho Q1(A, B) và Q2(D, E), Q3(B, D). Biểu thức nào dưới đây đúng  a. Q1 |X| Q2 |X| Q3  b. Q1 |X| (Q2 |X| Q3) 
c. Both a and b are correct 
50. Cho Q1(A: int, B: string, C: int) và Q2(A:int, B: string, D:int) và biểu thức 
 BFcount(A) as M(Q1) |X| Q2. Hãy cho biết phát biểu nào dưới đây là đúng      lOMoAR cPSD| 58605085
a. The above expression is incorrect because A has type int and cannot be used  with count() function 
b. The above expression is incorrect because the operation |X| is not performed  Okay 
c. The above expression performs a natural combination on the two attributes  A and B in Q1 and Q2  d. All are incorrect 
51. Cho SV(MaSV: string, Hoten: string, ĐiemTB: int) và DKY(MaSV:string, 
MaMH: string). Biểu thức nào dưới đây thực hiện đếm số môn học SV tên 
‘Nguyen Van A’ đã đăng ký. 
a. Hoten=’NguyenVan A’(MaSVFcount(MaMH) as SL(DKY) |X| SV) 
b. MaSVFcount(MaMH) as SL(DKY) |X| Hoten=’NguyenVan A’ (SV) 
c. MaSVFcount(MaMH) as SL(DKY) |X| MaSV( Hoten=’NguyenVan A’ (SV)) 
52. Cho Monhoc(MaMH: string, TenMH, SoTC) và Kqua(MaSV:string, 
MaMH:string, DiemMH:). Biểu thức nào dưới đây thực hiện tính tổng số tín chỉ 
mỗi SV tích lũy được (chỉ tính các môn có điểm >= 5) 
a. DiemMH >= 5(MaSVFsum(SoTC) as Tong(Monhoc) |X| Kqua) 
b. MaSVFsum(SoTC) as Tong(Monhoc) |X| DiemMH >= 5(Kqua) 
c. DiemMH >= 5(MaSVFsum(SoTC) as Tong(Monhoc |X| Kqua) 
d. MaSVFsum(SoTC) as Tong(Monhoc |X| DiemMH >= 5(Kqua)) 
53. Phát biểu nào dưới đây đúng 
a. There are three types of outer join: left outer join, right outer join and full  outer join      lOMoAR cPSD| 58605085
b. The result of the outer join is a new relation with the same number of 
attributes as the result of the inner join 
c. Number of tuples in the result relation of the outer join number of tuples in 
the result relation of the inner join  d. All are correct 
54. Cho Q1(A, B, C) và Q2(A, D, E). Biểu thức Q1 
 Q2 sẽ cho kết quả là một 
quan hệ mới có số bộ: 
a. Tương tự như số bộ trong quan hệ kết quả của Q1 |X| Q2 
b. Bao gồm các bộ của Q1 |X| Q2 và các bộ của Q1 không kết được với Q2, 
các thuộc tính thuộc Q2 trong các bộ này được gán giá trị null 
c. Bao gồm tất cả các bộ của Q1và các thuộc tính thuộc Q2 trong các bộ này  được gán giá trị null 
55. Cho Q1(A, B, C) và Q2(A, D, E). Biểu thức Q1 ⟗ Q2 sẽ cho kết quả là một 
quan hệ mới có các thuộc tính:  a. Q1.A, B, C, Q2.A, D, E 
b. Q1.A, Q1.B, Q1.C, Q2.A, Q2.D, Q2.E  c. A, B, C, D, E 
56. Cho SV(MaSV, Hoten) và Dangky(MASV, MaMH). 
Biểu thức MaSV( MaMH = null(SV 
 Dangky)) cho kết quả tương đương với kết quả  của biểu thức:  a. MaSV(SV) - MaSV(SV) 
b. MaSV( MaMH = null( MaSV(SV)   Dangky))