当前位置:网站首页>[database] final review (planning Edition)
[database] final review (planning Edition)
2022-06-24 12:43:00 【Betula alnoides forest】
P.S: Write the title according to the book exercise number
Apply to XBL The scope of the teacher's class
The contents are marked with ( Multiple choice and short answer questions )、 The example is cut from the sample paper
Catalog
- Chapter one
- 1、 Trial data 、 database 、 Database system 、 The concept of database management system .
- 2、 The benefits of using a database system ?
- 5、 Characteristics of database system ?
- 6、( choice / Judgment questions ) What are the functions of the database management system ?
- 7、 What is a conceptual model ? The role of conceptual models ?
- 14、 Features of relational database ?
- 15、 Three level pattern structure of database system ? Advantages of this structure ?
- 18、 Composition of database system
- Data model and data structure
- Chapter two ( important !!)
- The third chapter ( important !!)
- The order of the experiment class :
- experiment 1:
- (1) retrieval " Information (IS)" Information about the courses the students have learned , Including student ID 、 full name 、 Course names and grades .
- (2) retrieval " database " The course score is higher than 90 The student numbers of all students 、 full name 、 Major and score ;
- (3) Retrieve information about all students who did not fail in any one course , Including student ID 、 Name and major ;*
- (4) The retrieval age is older than 23 The student number and name of a male student aged .
- (5) Search the course number of the course that Wang Min did not learn .
- (6) Search student ID of at least two courses .
- (7) Retrieve the course number and course name of the course that all students take .
- (8) Count the number of courses selected by students .
- (9) Please 4 The average age of the students in the course .
- (10) Count the number of students in each course ( exceed 10 People's course statistics ).
- (11) The student ID is larger than that of Wang min , And the names of students younger than him .
- (12) Retrieve name to king The names and ages of all the students who started .
- (13) stay SC Retrieve the student number and course number with null score in .
- (14) Ask for the name and age of male students older than the average age of female students .
- (15) Name and age of male students older than all female students .
- Experiment two
- 2. Check the number of students who have taken courses
- 3. Look up the computer department (CS) Student ID of students who have taken two or more courses , full name
- 4. take 95001 Student elective 3 Change the grade of course No. to the average grade of that course
- 5. Inquire about student Table and sc The table is based on student number sno Equivalent connection / Natural join
- 6. Query the course number of the prerequisite course of the course ( Self connect )
- 7. Query students and their elective courses 、 Achievements, etc ( Students' information should be listed whether they take elective courses or not )
- 8. Check gender for male 、 Information and course number of students who have passed the course 、 achievement
- 9. Query and ’ Zhang Li ’ Information about students studying in the same department
- 10. Query the elective course named “ database ” The student number of 、 Name and department
- 11. Check which courses are only available to girls
- 12. Query all unselected items 1 Student name of course No
- 13. Query average score greater than 85 Your student number 、 full name 、 Average score
- Experiment three
- (1) Go to the basic table Student Insert a student tuple ('95999',' Zhang San ', 18).
- (2) In the basic table Student The score of each course is greater than or equal to 80 The student number of the student who is divided into three grades 、 Name and gender , And send the retrieved value to another existing basic table S (Sno , SNAME ,SEX).( You need to create a basic table first S)
- (3) In the basic table SC Delete the course selection tuple with no score in .
- (4) Delete all the records of the students whose names are Wang .
- (5) Take the elective course MATHS All failing grades in class are changed to null values .
- (6) Improve the grades of female students who are lower than the total average 5% .
- (7) In the basic table SC Revision in China C4 The results of the course , If the score is less than or equal to 75 Time sharing improves 5% , If the score is greater than 75 Time sharing improves 4% ( With two UPDATE Statements for ).
- Creation of textbook view 、 Modification example
- (1) Set up a view of information students , And is revising 、 During the insertion operation, you still need to ensure that the view only has information department students
- (2) Set up the Department of information 1 Student's view of Lesson No ( Including student ID 、 full name 、 achievement )
- (3) Set up the Department of information 1 Course No. and the course is in 90 Views of students with a score above
- (4) Define a view that reflects the year the student was born
- (5) Define the student number and grade average as a view
- (6) take student All records in the table are defined as a view
- (7) Delete view
- (8) In the view of information students, find out that they are younger than 20 Year old student
- (9) Check the elective course 1 Information students in course No
- (10) stay S_G The average score of query in the view is 90 The student number and average score of students with a score of above
- (11) Update the view
- (12) To the information department students view IS_Student Insert a new student record in
- (13) Delete Zhao Xin's record above
- 1、SQL Characteristics of language
- 5、SQL Example of operation textbook
- 6、 What is a basic watch ? What is a view ? The difference and connection between the two ?
- 7、( choice / Judgment questions ) Benefits of views ?
- 8、 What kind of views can be updated ? What kind of view is not updatable ? For example .
- Chapter four
- 1、 What is database security ?
- 2、 Give an example to illustrate the factors that threaten database security .
- 4、( choice / Judgment questions ) Common methods and techniques for database security control
- 5、 What are the autonomous access control method and mandatory access control method in database ?
- 7、 For relational patterns , use GRANT and REVOKE Statement completes the following authorization definition or access control functions .
- Example Delete the basic table and delete the tuple of the basic table
- The fifth chapter
- 1、 What is database integrity ?
- 2、( Short answer ) What is the difference and relationship between the concept of database integrity and the concept of database security ?
- 3、 What are database integrity constraints ?
- 4、 What three functions should the integrity control mechanism of relational database management system have ?
- 5、 Data integrity falls into four categories :
- Chapter six Relational database theory
- 1、 Definition of terms
- 2、 Build a relational database
- 6、 Give relational patterns , Determine the type of paradigm .
- 7、( Judgment questions ) Determine the type of paradigm
- 8、( Calculation questions ) Give relationship , Write closures , Judge the candidate code , Determine which paradigm
- Paradigm judgment notes :
- 9、 Minimum functional dependency set
- Chapter vii. Database design
- 1、( Short answer ) What is the database design process ?
- 6、 Terms in the conceptual model
- 10、E-R Graph to relational model
- 11、 Which paradigm does the candidate code in question 10 belong to ? What update exceptions will occur ?
- Example E-R The principle of transforming a graph into a relational pattern ( Big homework uses )
- Chapter ten ( No test , But just in case )
- Post exam feedback
Chapter one
1、 Trial data 、 database 、 Database system 、 The concept of database management system .
answer :
(1) data : The symbolic record that describes things is called data . Data and its semantics are inseparable .
(2) database (DB): The database is stored in the computer for a long time 、 organized 、 Sharable data set .
(3) Database system (DBS): By database 、 Database management system ( And its development tools )、 Application system 、 A system of database administrators .
(4) Database management system (DBMS): Database management system is a layer of data management software between the user and the operating system .
Example



DDL It's data definition language
DCL Is a data control language


2、 The benefits of using a database system ?
answer :
- It is conducive to the centralized management of data , Control data redundancy , Improve data utilization and consistency
- It is conducive to the development and maintenance of applications .
5、 Characteristics of database system ?
answer : Characteristics of database system :
- Data structure
- High data sharing 、 Low redundancy and easy expansion
- High data independence
- Data is managed and controlled by database management system
Example

6、( choice / Judgment questions ) What are the functions of the database management system ?
answer :
- Data definition function
- Data organization 、 Storage and management
- Data manipulation function
- Database transaction and operation management
- Establishment and maintenance of database
- Other features

7、 What is a conceptual model ? The role of conceptual models ?
answer : Conceptual model is an intermediate level from the real world to the machine world . It's modeling data and information from the user's point of view , Mainly used for database design .
Example

A representation of a conceptual model :E-R Model

14、 Features of relational database ?
answer :
- Centralized data control ;
- High data independence ;
- Good data sharing ;
- Low data redundancy ;
- Data structure ;
- Unified data protection function .
15、 Three level pattern structure of database system ? Advantages of this structure ?
answer : The three-level schema structure of database system means that the database system is composed of external schema 、 Mode and internal mode are composed of three levels .
(1) Pattern
Patterns are also called logical patterns , It is a description of the logical structure and characteristics of all data in the database , Is a common data view for all users .
(2) External mode
External mode is also called sub mode or user mode , Be able to see and use the logical structure and feature description of local data , It is the data and view of database users , Is a logical representation of the data at the right end of an application .
(3) Internal mode
Internal mode is also called storage mode , A database has only one internal schema . It is a description of the physical structure and storage of data , It's how the data is organized inside the database .
advantage : Leave the specific organization of data to the database management system , Enables users to logically 、 Process data abstractly , We don't have to care about the specific representation and storage of data in the computer .
Sample answer :
18、 Composition of database system
answer : Database system is generally composed of database 、 Database management system 、 Applications and database administrators make up . Specific refers to :
- Hardware platform and database
- Software
- personnel
Data model and data structure
Example


Chapter two ( important !!)
7、 The difference and connection between equivalent connection and natural connection

Example

Topic of relational algebra
The first question is

answer :
The second question is

answer :
Third question There are five basic operations in relational algebra
- and
- Bad
- The cartesian product
- choice
- Projection
ps: hand over 、 Connect 、 All can be expressed in the above five ways .
Fourth question Give relational patterns and find equivalent relational algebras

Fifth question What are the objects and results of relational algebra operations ?

The third chapter ( important !!)
SQL sentence
The order of the experiment class :

Be careful :
(3)(5) None of the outer layer queries of SC In the table , It is Student and Course surface , Because we need to find all the qualified student names and course names .
(6)(8) Remember to add distinct.
(7) There are three floors select, Note which table is queried in each layer .
(10) There is ascending and descending sorting .
(12) Character matching LIKE,NOT LIKE
(13) Null value IS NULL,IS NOT NULL
experiment 1:
(1) retrieval " Information (IS)" Information about the courses the students have learned , Including student ID 、 full name 、 Course names and grades .
select SC.Sno,student.Sname,Course.Cname,SC.Grade
From Student,Course,SC
where Student.Sno=SC.Sno AND SC.Cno=Course.Cno AND Student.Sdept='IS'
(2) retrieval " database " The course score is higher than 90 The student numbers of all students 、 full name 、 Major and score ;
select SC.Sno,student.Sname,Student.Sdept,SC.Grade
From Student,Course,SC
where Student.Sno=SC.Sno AND SC.Cno=Course.Cno AND Course.Cname=' database ' AND SC.Grade>90
(3) Retrieve information about all students who did not fail in any one course , Including student ID 、 Name and major ;*
select Student.Sno,Student.Sname,Student.Sdept
from Student
where sno in(
select distinct sno
from sc
where Sno not in(
select Sno
from sc
where grade<60
)
)
(4) The retrieval age is older than 23 The student number and name of a male student aged .
select Sno,Sname
from Student
where Sage > 23 and Ssex=' male '
(5) Search the course number of the course that Wang Min did not learn .
select cno
from Course
where cno not in(
select Course.cno
from SC
inner join Student on SC.Sno =Student.Sno
where Student.Sname=' Wang min. '
)
select Cno
from course
where cno not in(
select cno
from Student,sc
where Student.Sno=SC.cno and Student.sname=' Wang min. '
)
(6) Search student ID of at least two courses .
select distinct SC.sno
from SC
group by sno
having count(SC.cno)>=2
(7) Retrieve the course number and course name of the course that all students take .
select Course.Cno,Course.Cname
from Course
where Course.Cno in(
select SC.cno
from SC
group by SC.cno
having count(SC.sno)= (select count(sno)
from Student)
)
(8) Count the number of courses selected by students .
select count(distinct SC.cno)
from SC
(9) Please 4 The average age of the students in the course .
select AVG(Student.Sage)
from Student,SC
where Student.sno=SC.sno AND SC.cno='4'
(10) Count the number of students in each course ( exceed 10 People's course statistics ).
Require output of course number and number of electives , The query results are arranged in descending order of the number of people ,
If the number of people is the same , In ascending order of course number .
select Cno as ' Course no. ',COUNT(Sno) as ' The number of students who choose courses '
from SC
group by Cno
Having COUNT(Sno)>10
order by count(Sno) desc, Cno
(11) The student ID is larger than that of Wang min , And the names of students younger than him .
select sname
from student
where sno >(
select sno
from student
where sname=' Wang min. '
)
and sage <(
select sage
from student
where sname=' Wang min. '
)
Method 2 : there first and second All are student surface , Compare them as two tables
select first.sname
from student first, student second
where first.sno>second.sno and first.sage> second.sage and second.Sname=' Wang min. '
(12) Retrieve name to king The names and ages of all the students who started .
select Sname,Sage
from Student
where Sname like ' king %'
(13) stay SC Retrieve the student number and course number with null score in .
select Sno, Cno
from SC
where grade is null
(14) Ask for the name and age of male students older than the average age of female students .
select sname,sage
from student
where sage >(
select AVG(sage)
from student
where Ssex=' Woman '
)
and Ssex=' male '
(15) Name and age of male students older than all female students .
select sname,sage
from student
where Ssex=' male ' and sage> all(
select sage
from student
where Ssex=' Woman '
)
You can also put it here all Change to max
Experiment two
Be careful :
there 2. And experiment one (8) Is to query different things
7. want student Table to the left , To ensure that all student lists will appear
2. Check the number of students who have taken courses
select count(distinct sno)
from sc
3. Look up the computer department (CS) Student ID of students who have taken two or more courses , full name
select sno,sname
from student
where sno in(
select sno
from sc
group by sno
having count(sc.cno)>=2)
– The answer given by the teacher :
select student.sno,student.sname
from student,sc
where Student.sno = SC.Sno
group by student.sno,student.sname
having count(sc.cno)>=2
4. take 95001 Student elective 3 Change the grade of course No. to the average grade of that course
– The answer given by the teacher :
update sc
set grade = (
select avg(grade)
from sc
where cno = '3'
)where sno = '95001' and cno = '3'
5. Inquire about student Table and sc The table is based on student number sno Equivalent connection / Natural join
select Student.Sno, Sname,Ssex,Sage,Sdept,Cno,Grade
from Student inner join SC
on Student.sno=SC.Sno
How to write it 2:
select Student.Sno, Sname,Ssex,Sage,Sdept,Cno,Grade
from Student, SC
where Student.Sno=SC.sno
– Note that it can't be written as select *, Because there will be repeated sno Column
6. Query the course number of the prerequisite course of the course ( Self connect )
select first.Cpno, second.Cpno
from Course first, Course second
where first.Cpno=second.Cno
– Variant : Query the course name of the prerequisite course of the course
select x.cname, z.cname
from course x, course y, course z
where x.cpno = y.cno and y.cpno = z.cno
7. Query students and their elective courses 、 Achievements, etc ( Students' information should be listed whether they take elective courses or not )
select Student.Sno, Sname,Ssex,Sage,Sdept,Cno,Grade
from student left outer join SC
on Student.Sno=SC.Sno
8. Check gender for male 、 Information and course number of students who have passed the course 、 achievement
select Student.*,Cno,Grade
from Student,sc
where Student.Sno=SC.Sno and SC.Grade>=60 and Student.Ssex=' male '
Write two :
select Student.*,Cno,Grade
from Student inner join SC
on Student.Sno=Sc.sno
where SC.Grade>=60 and Student.Ssex=' male '
– Variant : Add one “ There is no record of failing ” Conditions
select Student.*,Cno,Grade
from Student,sc
where Student.Sno=SC.Sno and SC.Grade>=60 and Student.Ssex=' male ' and Student.Sno not in
(
select sno
from sc
where Grade<60
)
9. Query and ’ Zhang Li ’ Information about students studying in the same department
select *
from Student
where Sdept in(
select Sdept
from Student
where Sname=' Zhang Li '
)and sname !=' Zhang Li '
– there Sdept in() Or you could write it as Sdeot =(), Because the subquery only returns one value .
– Finally, don't forget to eliminate Zhang Li
10. Query the elective course named “ database ” The student number of 、 Name and department
select Student.Sno,Sname,Sdept
from Student,SC,Course
where Student.Sno=SC.Sno and SC.cno=Course.Cno and Course.Cname=' database '
11. Check which courses are only available to girls
– Wrong writing :( Ignored “ Only ” Conditions , This may include courses that both boys and girls have taken )
select distinct Course.Cname
from Course,SC,Student
where Student.Sno=SC.Sno and SC.cno=Course.Cno and Student.Ssex=' Woman '
– Don't forget to add distinct
– To be in SC Look in the form , Not in Course Look in the table . Otherwise, there will be courses that neither boys nor girls have taken .
– The answer given by the teacher :
select distinct cno
from sc
where cno not in(
select distinct cno
from student,sc
where student.sno = sc.sno and ssex = ' male '
)
12. Query all unselected items 1 Student name of course No
select Student.sname
from Student
where not exists(
select sno
from sc
where student.sno=sc.sno and cno='1'
)
– The answer given by the teacher :
select Student.sname
from Student
where sno not in(
select sno
from sc
where cno='1'
)
–not exists Or you could write it as not in
– But don't write it here where cno<>‘1’, Otherwise, there will be elective courses 1 The names of the students who took other courses in the No. 1 course appear
13. Query average score greater than 85 Your student number 、 full name 、 Average score
select Student.Sno,Sname, AVG(SC.Grade) as avg_grad
from Student inner join SC on Student.sno=sc.sno
group by Student.Sno,Sname
having AVG(SC.Grade)>85
– Inquire about sno and sname,group by Both of these should be included in the ( just sno and sname It's one-to-one ), Otherwise, it will report a mistake
Don't forget to inner join That line says
Experiment three
(1) Go to the basic table Student Insert a student tuple (‘95999’,‘ Zhang San ’, 18).
insert
into Student(Sno,Sname,Sage)
values('95999',' Zhang San ',18)
select * from Student
(2) In the basic table Student The score of each course is greater than or equal to 80 The student number of the student who is divided into three grades 、 Name and gender , And send the retrieved value to another existing basic table S (Sno , SNAME ,SEX).( You need to create a basic table first S)
create table S(
Sno char(5) primary key,
Sname char(20),
Sex char(2)
);
insert
into S(Sno,Sname,Sex)
select distinct Student.Sno,Sname,Ssex
from Student
where Sno in(
-- Writing a :
select Sno
from SC
where Sno not in(
select Sno
from SC
where grade<80
)
)
select * from S
– Write two : This outermost layer does not require distinct
select sno
from sc
group by sno
having min(grade)>=80
(3) In the basic table SC Delete the course selection tuple with no score in .
delete
from sc
where Grade is null
select * from sc
(4) Delete all the records of the students whose names are Wang .
delete
from sc
where sno in(
select sno
from Student
where sname like ' king %')
(5) Take the elective course MATHS All failing grades in class are changed to null values .
– Test data is inserted :
insert
into sc(sno,cno,grade)
values(‘95004’,‘2’,55)
– Update Form
update sc
set grade = null
where Grade<60 and cno = (
select cno
from course
where cname=' mathematics '
)
select * from sc
– Delete test data :
delete
from sc
where grade is null
(6) Improve the grades of female students who are lower than the total average 5% .
update sc
set grade=grade*1.05
where grade in(
select distinct grade
from Student,sc
where student.sno=sc.sno and student.Ssex=' Woman ' and sc.grade < (
select avg(Grade) -- The previous topic added null value , Remember to delete it and then calculate the average
from sc
)
)
– How to write it 2:
update sc
set grade=grade*1.05
where grade<(
select AVG(Grade)
from sc inner join Student on student.sno = sc.sno
where Ssex=' Woman '
)
– The answer given by the teacher :
update sc
set grade=grade*1.05
where grade<(
select avg(grade)
from sc
)and sno in(
select sno
from student
where ssex = ' Woman '
)
(7) In the basic table SC Revision in China C4 The results of the course , If the score is less than or equal to 75 Time sharing improves 5% , If the score is greater than 75 Time sharing improves 4% ( With two UPDATE Statements for ).
update sc
set grade = grade*1.04
where grade>75 and cno='4'
update sc
set grade = grade*1.05
where grade<=75 and cno='4'
– This question has a sequence ?!
– If less than... Is modified first 75 Points of , The score may rise to 75 branch , And then to greater than 75 Sub processing , It turns into two revisions of grades , This is a mistake !
Creation of textbook view 、 Modification example
(1) Set up a view of information students , And is revising 、 During the insertion operation, you still need to ensure that the view only has information department students
go
create view IS_Student
as
select sno,sname,sage
from Student
where Sdept='IS'
with check option
go
select * from IS_Student
(2) Set up the Department of information 1 Student's view of Lesson No ( Including student ID 、 full name 、 achievement )
go
create view IS_S1(Sno,Sname,Grade)
as
select Student.sno,sname,grade
from Student,SC
where Sdept='IS' and Student.Sno=SC.Sno and SC.Cno='1';
go
select * from IS_S1
(3) Set up the Department of information 1 Course No. and the course is in 90 Views of students with a score above
go
create view IS_S2
as
select sno,sname,grade
from IS_S1
where grade>=90;
go
select * from IS_S2
(4) Define a view that reflects the year the student was born
go
create view BT_S(sno,sname,sbirth)
as
select sno,sname,2014-sage
from student
go
select * from BT_S
(5) Define the student number and grade average as a view
go
create view S_G(Sno,Gavg)
as
select sno,AVG(Grade)
from sc
group by Sno
go
select * from S_G
(6) take student All records in the table are defined as a view
go
create view F_Student(F_sno,name,sex,age,dept)
as
select *
from student
where Ssex=' Woman ';
go
select * from F_Student
(7) Delete view
drop view BT_S
(8) In the view of information students, find out that they are younger than 20 Year old student
select sno,sage
from IS_Student
where sage<20
(9) Check the elective course 1 Information students in course No
select IS_Student.Sno,Sname
from IS_Student,SC
where IS_Student.Sno = SC.Sno and SC.Cno = '1';
(10) stay S_G The average score of query in the view is 90 The student number and average score of students with a score of above
select *
from S_G
where Gavg>=90;
– How to write it 2: Subqueries produce a derived table S_G
select *
from (select sno,AVG(grade)
from sc
group by sno
) as S_G(sno,Gavg)
where Gavg>=90;
(11) Update the view
– View information department students IS_Student The middle school number is “95002” The student's name was changed to “ Liu Chen ”
update IS_Student
set Sname=' Liu Chen '
where sno='95002'
(12) To the information department students view IS_Student Insert a new student record in
insert
into IS_Student
values('95009',' Zhao Xin ','20')
select * from Student
– Pay attention to the above writing IS_Student Will not show , Because of the specialty sdept The default is yes null 了
(13) Delete Zhao Xin's record above
delete
from IS_Student
where Sno='95009'
1、SQL Characteristics of language


Example


5、SQL Example of operation textbook
form :S supplier P Spare parts J The project SPJ Supply situation table 
subject :
Be careful :
(3)(7) Yes DIST
(8)-(11) Is an update 、 Delete 、 Insert operation statement
6、 What is a basic watch ? What is a view ? The difference and connection between the two ?
answer :
Example

7、( choice / Judgment questions ) Benefits of views ?
answer :
- View can simplify the operation of users ;
- Views enable users to view the same data from multiple perspectives ;
- Views provide a certain degree of logical independence for refactoring databases ;
- View can provide security for confidential data .
8、 What kind of views can be updated ? What kind of view is not updatable ? For example .
answer : The row and column subset view of the basic table is generally Renewable .
If attributes of the view come from collection function 、 expression , Then the view must be Not updatable .
Whether all views can be updated ? Why? ?
answer : No . Views are virtual tables that don't actually store data , So updates to the view , The final conversion is to update the basic table . Because updates to some views cannot be meaningfully translated into updates to the corresponding base tables , therefore , Not all views are updatable .
Chapter four
1、 What is database security ?

Example

2、 Give an example to illustrate the factors that threaten database security .
answer :
- Unauthorized Malicious storage and destruction of databases by users .( Hackers and criminals hunt for user names and passwords when users access databases )
- In the database Important or sensitive data Leaked .
- Safe environment The fragility of .( Such as operating system and network )
4、( choice / Judgment questions ) Common methods and techniques for database security control
answer :
5、 What are the autonomous access control method and mandatory access control method in database ?
answer :
7、 For relational patterns , use GRANT and REVOKE Statement completes the following authorization definition or access control functions .



Example Delete the basic table and delete the tuple of the basic table

The fifth chapter
1、 What is database integrity ?
answer : Database integrity refers to the correctness and compatibility of data .
Example

2、( Short answer ) What is the difference and relationship between the concept of database integrity and the concept of database security ?
answer :
3、 What are database integrity constraints ?
answer : The integrity constraint is The semantic constraints that the data in the database should meet .
Generally, it can be divided into six categories : Static column level constraints 、 Static tuple constraint 、 Static relationship constraints 、 Dynamic column level constraints 、 Dynamic tuple constraint 、 Dynamic relationship constraints .
- Static column level constraint is a description of the value field of a column , It includes the following aspects :(1) Constraints on data types , Including the type of data 、 length 、 Company 、 Precision etc. :(2) Constraints on data format ;(3) Constraints on value range or value set :(4) Constraints on null values ;(5) Other constraints .
- Static tuple constraint is to specify the constraint relationship between the columns that make up a tuple , Static tuple constraints are limited to a single tuple .
- Static relation constraint is that there are various connections or constraints between the tuples of a relation or between several relations .
Common static relationship constraints are :(1) Entity integrity constraints ;(2) Refer to integrity constraints ;(3) Functional dependency constraints . - Dynamic column level constraints are the constraints that should be met when modifying column definitions or column values , Including the following two aspects :(1) Constraints when modifying column definitions .(2) Constraints when modifying column values .
- Dynamic tuple constraint refers to the need to refer to its old value when modifying the value of a tuple , And some constraints need to be met between the old and new values .
- Dynamic relationship constraints are constraints placed on the state before and after the relationship changes , For example, transaction consistency 、 Constraints such as atomicity .
Example


4、 What three functions should the integrity control mechanism of relational database management system have ?
answer :DBMS The integrity control mechanism should have three functions :
- Define functions , I.e Define integrity constraints The mechanism of ;
- Check function , namely Check the operation request sent by the user Whether integrity constraints are violated ;
- Default reaction , If it is found that the user's operation request causes the data to violate the integrity constraints , be Take certain actions To ensure the integrity of the data .
5、 Data integrity falls into four categories :
- Entity integrity ( In a relationship The primary attribute value cannot be Null And cannot have the same value . All rows in the definition table can be uniquely identified , The primary key is usually used , unique index unique keyword , And identity Properties, for example, our ID number. , Can uniquely identify a person .)
- Referential integrity ( The foreign key in a relationship must be a valid primary key value of another relationship , Or is it NULL. Reference integrity maintains the validity of inter table data , integrity , It is usually achieved by establishing an external key to contact the primary key of another table , Triggers can also be used to maintain reference integrity )
- User defined integrity .
Chapter six Relational database theory
Page below 1、2 Long answer warning !
I feel sleepy myself
see The video P2 Make it quick
1、 Definition of terms
- Function dependency
- Part of the function depends on
- Completely function dependent
- Transitive dependency
- Candidate code
- Main code
- Outer code
- normal form
answer :

2、 Build a relational database
Add : On the minimum functional dependency Knowledge point





6、 Give relational patterns , Determine the type of paradigm .

answer :
(1)BC It's also R The candidate code for
(2)BCE、ACE、CDE
(3)R The candidate code for BCE、ACE、CDE, There is no code partial or transitive dependency on non primary attributes , therefore R Belong to 3NF. Among the three functional dependencies , None of the determinants contain codes , therefore R Do not belong to BCNF.
7、( Judgment questions ) Determine the type of paradigm

The answer to this question comes from This article
answer :
(1) Any binocular relation belongs to 3NF Of .
correct . Only two properties do not have a transfer function dependency .
(2) Any binocular relation belongs to BCNF Of .
correct . There are only two properties , The determinant must contain code .
(3) Any binocular relation belongs to 4NF Of .
correct . Only two attributes do not have nontrivial multivalued dependencies .
(4) If and only if the function depends on A→B stay R On the establishment of , Relationship R(A,B,C) Equal to its projection R1(A,B) and R2(A,C) The connection of .
error . When a function depends on B→A stay R When it was established , Relationship R(A,B,C) Also equal to its projection R1(A,B) and R2(A,C) The connection of .
(5) if R.A→R.B,R.B→R.C be R.A→R.C.
correct .
(6) if R.A→R.B,R.A→R.C, be RA→R.(B,C).
correct .
(7) if R.B→R.A,R.C→R.A, be R.(B,C)→R.A.
correct .
(8) if R.(B,C)→R.A, be R.B→R.A,R.C→R.A.
error . according to B、C There are two attributes to determine A. For example, only knowing the student number and course can determine the grade , Only knowing the student number or the course can not determine the grade .
8、( Calculation questions ) Give relationship , Write closures , Judge the candidate code , Determine which paradigm
The following is a must see example !!!
Example
Paradigm judgment notes :

Example





9、 Minimum functional dependency set

Chapter vii. Database design
1、( Short answer ) What is the database design process ?
answer :
- Demand analysis
- Conceptual structural design
- Logical structure design
- Physical structure design
- Database implementation
- Database operation and maintenance
A detailed version :

6、 Terms in the conceptual model

10、E-R Graph to relational model
subject :
You can see this video Understanding process :

11、 Which paradigm does the candidate code in question 10 belong to ? What update exceptions will occur ?
The answer is This blog
Example E-R The principle of transforming a graph into a relational pattern ( Big homework uses )


Chapter ten ( No test , But just in case )
1、 Business
Transaction is a user-defined sequence of database operations , It's an indivisible unit of work . It is the basic unit of data recovery and concurrency control .
2、 The transaction ACID characteristic
Atomicity Atomicity
Consistency Uniformity
Isolation Isolation,
Durability Continuity



That's the whole range .
Post exam feedback
Tested many to many relationship ER chart 、 Write a relational model , Find the outer code in the model
The logical implication is also examined , And prove whether it is 3NF
And blocking granularity
Test the data 、 Database, etc 4 A brief answer to each concept
END
边栏推荐
- 【2022国赛模拟】摆(bigben)——行列式、杜教筛
- The pod is evicted due to insufficient disk space of tke node
- [2022 national tournament simulation] BigBen -- determinant, Du Jiao sieve
- Clickhouse uses distributed join of pose series
- It's settled! Bank retail credit risk control just does it!
- Istio practical skills: using prism to construct multi version test services
- Tencent released credit risk control results safely: it has helped banks lend more than 100 billion yuan
- Kubernetes best practice: graceful termination
- Kubernetes practical skills: use cert manager to issue free certificates for DNSPod domain names
- Chenglixin research group of Shenzhen People's hospital proposed a new method of multi group data in the diagnosis and prognosis analysis of hepatocellular carcinoma megps
猜你喜欢

QT -- the qtabwidget supports dragging tabbar items

【数据挖掘】期末复习(样卷题目+少量知识点)

巴比特 | 元宇宙每日必读:618成绩已然揭晓,在这份还算满意的答卷背后,数字藏品做出了多少贡献?...

On the value foam of digital copyright works from the controversial nature of "Meng Hua Lu"

Opencv learning notes -- Separation of color channels and multi-channel mixing
[mysql_16] variables, process control and cursors

【2022国赛模拟】摆(bigben)——行列式、杜教筛

Installation and operation of libuv

从《梦华录》的争议性,谈谈数字版权作品的价值泡沫

微医CodeReview工具链
随机推荐
105. 简易聊天室8:使用 Socket 传递图片
Babbitt | metauniverse daily must read: 618 scores have been announced. How much contribution has the digital collection made behind this satisfactory answer
Which commercial insurance endowment insurance is good? Ranking of commercial endowment insurance products in 2022
Smart photovoltaic energy - visualization of photovoltaic power generation energy management and control in the park
How can a shell script (.Sh file) not automatically close or flash back after execution?
Speculation London gold short-term stable money making skills? Where is it safe to fry London gold?
微医CodeReview工具链
[Tencent cloud 618 countdown!] Promotion strategy of the promotion activities
Ingenious conception - iron death regulatory factor classification and prognosis 6+
How to solve the problem that MBR does not support partitions over 2T, and lossless transfer to GPT
What should music website SEO do?
Kubernetes practical technique: setting kernel parameters for pod
Discussion on redis communication protocol
How to calculate the bandwidth of video transmission? How much bandwidth is required to transmit 4K video?
Simple and flexible permission design?
[redisson] analysis of semaphore lock source code
How to open a new bond? Is it safe to open an account
Identification of new prognostic DNA methylation features in uveal melanoma by 11+ based on methylation group and transcriptome analysis~
解析nc格式文件,GRB格式文件的依赖包edu.ucar.netcdfAll的api 学习
Kubernetes practical skills: use cert manager to issue free certificates for DNSPod domain names