Author: Dolphin
Original address: http://blog.csdn.net/qingdujun/article/details/27821271
First, the choice question
1. In the following operations, B is not a basic operation of relational algebra.
A Cartesian product B. Natural Join C. Projection D. And
2. The set of attributes that uniquely identify a tuple in a relationship is called a of the relational model.
A Primary key B. Super Key C. Candidate Key D. FOREIGN key
3. After the projection operation of the relationship R, the relationship s is obtained, then D .
A The number of tuples of the relationship R equals the number of tuples of the relationship s
B The number of tuples of the relationship R is less than the tuple number of the relationship s
C The number of tuples of relationship R is greater than that of relation s
D The number of tuples of a relationship r greater than or equal to the number of tuples of the relationship s
4. Relationship R and relationship s have only one public property, T1 is the result of R and S equivalent join, and T2 is the result of R and S equivalent natural joins, then C .
A The number of attributes of T1 equals the number of attributes of T2
B The number of attributes for T1 is less than the number of T2 properties
C The number of attributes of the T1 is greater than the number of T2
D Number of attributes of T1 greater than or equal to T2
5. In the relational Algebra expression optimization strategy, the C operation should be performed as early as possible.
A Projection B. Join C. Select D. Cartesian product
6. The query language of a relational database is a B language.
A Procedural B. Non-procedural C. Third generation D. Advanced Programming
7. Clauses in SQL that set primary and foreign keys belong to the a range of DBS.
A Integrity Control B. Security Control C. concurrency control control d. Recovery control
Two, fill in the blanks questions
8. A relational schema is defined in the form R (u,d,dom,f) .
9. The definition of a relational schema mainly includes ① relationship name , ② attribute name , ③ domain name , ④ attribute to the domain image , and keywords.
10. The smallest unit of data that can be named in a relational database is the field name .
11. In the information represented by an entity, a group of attributes is said to uniquely identify a tuple as a keyword.
Iii. Jiang/Comprehensive questions
1. Describe the differences and linkages between equivalent connections and natural connections.
A: 1) Difference: The natural connection is to remove the duplicate attribute columns.
2) Contact: All the tuples from the generalized Cartesian product that have the same attribute values selected.
2. Illustrate the meaning of relationship referential integrity? answer: a little.
3. The five basic operations in relational algebra are represented by a tuple-relational calculus expression.
1) and: R∪s = {T|t∈rνt∈s}
2) Poor: R-s = {t|t∈rλt////}
3) Select 4) projection 5) Cartesian product: The symbol is too hard to beat.
See also: p47,p53
4. As shown in the three relationships S, C, and SC, the trial relational algebra expression represents the following query
S
s# |
Snmae |
Age |
SEX |
1 |
Li Qiang |
23 |
Man |
2 |
Liu Li |
22 |
Woman |
5 |
Zhang You |
22 |
Man |
C
C# |
Cnmae |
TEACHER |
K1 |
C language |
Simon |
K5 |
Database principles |
Cheng June |
K8 |
Compilation principle |
Cheng June |
Sc
s# |
C# |
GRADE |
1 |
K1 |
83 |
2 |
K1 |
85 |
5 |
K1 |
92 |
2 |
K5 |
90 |
5 |
K5 |
84 |
5 |
K8 |
80 |
(1) Search for the course number (C #) and course name (CNAME) of the course taught by the "Cheng June" teacher.
(2) to retrieve the male student number (s#) and name (SNAME) with age greater than 21.
(3) The name of the student who has enrolled at least one of the courses taught by the "Cheng June" Teacher (SNA? E).
(4) Search "Li Qiang" students do not learn the course number (C #).
(5) Retrieve the student number (C #) with at least two elective courses.
(6) Retrieve the course number (C #) and course name (CNAME) of the courses that all students take.
(7) The search elective course contains the student number (s#) of one of the courses taught by the "Cheng June" teacher.
(8) To retrieve the student number (s#) of the elective course number K1 and K5.
(9) The name of the student taking all the courses (SNAME) is searched.
(10) The search elective course contains the student number (s#) of the course of the student number 2.
(11) To retrieve the student number (s#) and name (SNAME) of the elective course entitled "C Language".
5. For the relationship S, C, and SC, the trial tuple calculus expression represents the following query statement.
(1) Search the student number and grade of the elective course number K5.
(2) Search for the student number and name of the elective course number K8.
(3) to retrieve the student number and name of the elective course entitled "C Language".
(4) Search the student number of the elective course number K1 or K5.
(5) Search the student number for elective course number K1 and K5.
(6) Search for names and ages of students who do not take the K8 course.
(7) Search for the names of all students taking all courses.
(8) The search for the selected course includes student number of the course selected by Student No. 1th.
6. For the relationship of the previous problem S, C, and SC, the trial domain calculus expression represents the following query statement.
(1) Search the student number and grade of the elective course number K5.
(2) Search for the student number and name of the elective course number K8.
Reference: Wang Shan, Shaman Xuan Munsu. Introduction to Database Systems (4th edition) [M]. Beijing: Higher Education Press, 2006.43-73.