Database Review Questions 02

Multiple choice questions
1~5BDBDA
6~10ABCBA
11~15DBBAC

Fill in the blanks
1. The data model consists of ___data structure___, ____data manipulation___, ___integrity constraint___
2. The SQL statement to create a unique index (Stusname) on the sname column of the student table is:
create unique index idx_name on student(sname)
3. The "<>" in the query condition of the select statement is equivalent to the predicate ___not in____
4. There are only ___definition___ of the view in the database, and the corresponding view is not stored ____Data____
5. Character matching "%" indicates that ___ matches 0 to multiple characters___, "_" indicates that ___ matches one character___
6. In database design, write data requirements into documents , it is a combination of various data descriptions, including data items, data structures, data storage and data processing descriptions, usually called ___data dictionary___ 7. Known
relationship R(A,B,C,D ) and the functional dependency set F={A->CD,C->B} on R, then the candidate code of R is ___A___, R∈___3___NF 8. Special relational operations in relational algebra include ___σ (selection)
___ , π (projection), ___⋈ (connection) ___, ÷ (division), etc.
9. The basic principle of database system failure recovery is ___ using redundancy technology ___
10. Access control is divided into ___ autonomous access Control ___ and ___ mandatory access control ___
11. The method of eliminating redundancy in ER diagram ___ analysis method ___ and ___ normalization theory method ___
12. AFTER expression in trigger __ _The trigger command is executed after the dml modifies the data___

Short answer questions
3.
(1) What are the three inference rules of the Armstrong axiom system? What three useful rules of inference can be derived from these three rules of inference?
Three inference rules are: reflexive law, augmentation law, transitive law; three rules: merge rule, decomposition rule and transfer rule.
(2) Describe the three-level blocking protocol.
First-level blocking protocol: before the transaction T modifies the data R, it must first add an X lock to it, and it will not be released until the end of the transaction.
Second-level blocking protocol: on the basis of the first-level blocking protocol, the transaction T must be S-locked before reading the data R, and the S-lock can be released after reading. The third-level blocking
protocol: on the basis of the first-level blocking protocol Adding a transaction T to the data R before reading it must first add an S lock to it, and it will not be released until the end of the transaction.
(3) SC_{1}=R_{2}(A)R_{1}(B)W_{2}(A)R_{2}(B)R_{3}(A)W_{1}(B)W_{3}(A)W_{2}(B)Is the scheduling conflict serializable? Why?
It is a conflict serializable scheduling, because the above scheduling can be rewritten as: R_{1}(A)W_{1}(A)R_{1}(B)W_{1}(B)R_{2}(A)W_{2}(A)R_{2}(B)W_{2}(B)it is equivalent to executing a serial operation T_{1},T_{2}. So, this is conflict serializability.

Application questions
A certain group has several factories, and each factory produces a variety of products...
(1) ER diagram, relational model
(2) Point out the primary key and external key of each relational model

Set up a project supply database system with the following four relational models:
supplier S (sno, sname, status, city)
part P (pno, pname, color, weigth)
project J (jno, jname, city)
supply situation SPJ (sno, pno,jno,qty)
(1) Use relational algebra to query the project number of the red part of the Tianjin supplier
(2) SQL query project J1, the part is red, and the project number jno (not repeated) (nested)
(3) SQL query The engineering number of the parts produced by the supplier in Tianjin is not used (double nesting)
(4) Authorize the query and insertion authority of the S table to USER1
(5) Create parts whose storage location is Shanghai and whose inventory is greater than 5000 view

Suppose the relational model R(A,B,C,D,E,P), its functional dependency set:
F={A->D,E->D,D->B,BC->D,DC->A }Find all the candidate codes of R.
The L attributes are: CE 
The LR attributes are: ABD  
The NLR attributes are: P 
, so CEP must appear in the candidate codes of R, (CEP)F+=ABCDEP, so the candidate code of R is CEP

Suppose the relational model R(S,D,I,B,O,Q), its functional dependency set:
F={S->D,I->B,B->O,O->Q,Q->I }, seek all the candidate codes of R.
The L attributes are: S 
The LR attributes are: BOQI  
The R attributes are: D
, so S must appear in the candidate codes of R, (SB)F+=SDBIOQ, so the candidate codes of R are SB
(SQ )F+=SDQIBO, so SQ is also a candidate code for R
(SI) F+=SBIDOQ, so SI is also a candidate code for R

 

Guess you like

Origin blog.csdn.net/qq_38889101/article/details/125163541