当前位置:网站首页>Final review of Database Principles
Final review of Database Principles
2022-07-03 08:36:00 【Jiamei no error】
The first 1 Chapter
The introduction
database (DB): It is the aggregation of database data , And the data in this collection must be able to be managed by the computer and shared by multiple users
Database management system (DBMS): It is a large-scale software for manipulating and managing databases , It consists of a set of computer programs
Database system (DBS): By hardware and software 、 The database and users together constitute . Hardware is mainly used to store data in the database , Including computers 、 Storage devices, etc . The software part mainly includes the database management system 、 An operating system that supports the operation of a database management system , And support the access technology of multi language application development .
A complete database system generally consists of databases 、 Database management system 、 Application development tools 、 Application system 、 Database administrators and users .
The database system mainly includes the following 3 Components :
database : A place for storing data .
Database management system : Software for managing databases .
Database applications : In order to improve the processing capacity of the database system, the software used to manage the database is supplemented .
database (DataBase,DB) It provides a storage space to store all kinds of data , You can think of a database as a container for storing data . A database may contain many files , A database system usually contains many databases .
Database management system (Database Management System,DBMS) It's user creation 、 The software used to manage and maintain a database , Between the user and the operating system , Unified management of the database .DBMS Can define data storage structure , The operation mechanism of providing data , Maintain database security 、 Integrity and reliability .
Database applications (DataBase Application) The use of data management can meet the higher requirements of data management , It can also make the data management process more intuitive and friendly . The database application is responsible for working with DBMS communicate 、 Access and management DBMS Data stored in , Allow users to insert 、 modify 、 Delete data from database .
Characteristics of database system : Data structure 、 Low data redundancy 、 High sharing 、 Avoid data inconsistency 、 High data independence 、 from DBMS Unified management and control ( Security 、 integrity 、 concurrency control 、 Database recovery )
Data model :
Refers to the simulation and abstraction of real-world data and information , Used to describe data 、 Compose data and operate on data
classification : Conceptual data model 、 Logical data model 、 Physical data model
Components : data structure 、 Data manipulation 、 Data integrity constraints
Square box : Entity set
Diamond frame : contact
Elliptical box : attribute
Three level pattern structure : External mode 、 Conceptual model 、 Internal mode ( A database can have multiple external schemas 、 A database can only have one internal schema
Two level image : External mode image 、 Inside ~
The first 2 Chapter
relational database
Domain : Is a set of values with the same data type
code :
It consists of one or several attributes
Candidate code : In a relationship , Attribute or minimum attribute set that can uniquely identify tuples
Main code : There are multiple candidate codes in a relationship, choose one as the main code
Outer code
Relationship integrity constraints : Using integrity constraints is to use integrity rules to constrain the relationship
The values of the two main codes are unique in the table 、 affirmatory , All attributes of the specified relationship on the master code cannot be null , Instead, the main code as a whole cannot be null
Entity integrity : The primary code is unique and not empty
Referential integrity : The outer code is either empty , Or corresponding to other table main codes
User defined integrity : Write it completely
The cartesian product :
Inquire about :


Natural join :
The discarded ones are called floating tuples
except :
The first 3 Chapter
Relational database standard language SQL
SQL characteristic : Highly unprocessed 、 Fully functional and integrated 、 Unified grammatical structure 、 The language is simple , Easy to learn and easy to use
SQL Define functions :
The definition of the table :
create table Table name ( Various attributes );
create table user(
name varchar(20),
age int
)
Delete
CASCADE For foreign key
drop table student CASCADE
Change
alter table student alter column sage int;
Inquire about
id,title Modifiable name
select *from student;
selsct *from user where id=9 and password=123;
The results were de duplicated
selsct distinct title Course name from edu_course;
Add conditions to the query results
selsct title Course name from edu_course where price between 10 and 999;
% Can represent multiple characters , Underline _ Representing one
group by grouping , Screen selection having
For equivalent connection where
select *from edu_course ec,edu_course_description ecd where ec.id=ecd.id;
Check the total number of students
select count(*) as The total number of
from Student ;
Check the average age of computer college students
select avg(year(now))- Year of birth ) as Average age
from Student
where college =' Computer '
Inquiry learning 180101 The highest score of students in course No
select max( achievement ) as The highest
from Study
where Course no. ='180101'
Check options 180102 Student ID and grade of course No , The results are ranked from high to low
select Student number , achievement
from Study
where Course no. ='180102'
order by achievement desc
Composite conditional join query
Check options 180101 And the grade is in 90 The student number of the above students , Name and grade
select Student . Student number , full name , achievement
from Student , Study
where Student . Student number = Study . Student number
and Study . Course no. ='180101'
and Study . achievement >90
nested queries
select full name
from Student
where Student number in
(select Student number
from Study
where Course no. ='180101');
Insert a single tuple
insert
into Student
values('111',' Xia Yu ',' male ',' Computer ');
Insert subquery results
insert
into dept_age(sdept,avg_age)
select college ,avg(year(now())- Year of birth )
from Student
group by college
Delete
delete
from Student
where Student number ='092010';
Change
update Student
set Place names =' jiangsu '
where Course no. ='1111'
Modification of subquery
update Study
set achievement =0
where Student number in
(select Student number
from Student
where college =' Computer ');
View :
create view cs_view
as select *
from Student
where college =' Computer ';
Delete view
drop view < View name >
Query view
select *
from cs_view
where year(now())- Year of birth <20;
Update the view
Insert 、 Delete 、 modify
The first 4 Chapter
Relationship normalization theory
Function dependency :
Functional dependence of code :
In relation mode R in , A set that uniquely determines the minimum attributes of a tuple
if X Sole determination Y, be XY There is a functional relationship between
set up K by R<U,F> Properties or property groups in , if K–f—>U, be K by R The candidate code for , There are more than one candidate codes. Choose one of them as the main code 

Normal form to BC normal form :

Closure :

Code value theory :
Armstrong axiom 

rely on :
Minimum dependence :
The first 6 Chapter
Database protection
Business :
It is to package a group of database operations to form a logically independent work unit , This unit of work is indivisible , The database operations included in it either all occur , Or none of it will happen
characteristic : Atomicity 、 Uniformity 、 Isolation, 、 persistence
Database recovery :
Fault type : Transaction internal failure 、 System failure 、 Media failure 、 Computer virus
implementation technique : Establish redundancy through data dump 、 Establish redundancy through log files 、 Fault recovery
边栏推荐
- [audio and video] ijkplayer error code
- P1596 [USACO10OCT]Lake Counting S
- Constraintlayout's constraintset dynamically modifies constraints
- Talking about: is the HashSet set ordered or disordered /hashset set unique, why can we store elements with the same content
- KunlunBase MeetUP 等您来!
- Un système de gestion de centre commercial pour la conception de cours de technologie d'application de base de données
- P1596 [USACO10OCT]Lake Counting S
- MySQL 8
- 简易入手《SOM神经网络》的本质与原理
- Redis cluster series 4
猜你喜欢

Unity editor expansion - controls, layouts

MXone Pro自适应2.0影视模板西瓜视频主题苹果cmsV10模板

Kwai 20200412 recruitment

Mall management system of database application technology course design

VIM learning notes from introduction to silk skating

梯度下降法求解BP神经网络的简单Demo

Detailed explanation of all transfer function (activation function) formulas of MATLAB neural network

Unity Editor Extension - drag and drop

Minimap plug-in

Graphics_ Games101/202 learning notes
随机推荐
796 · unlock
Introduction to Base64 coding
【Rust 笔记】09-特型与泛型
【Rust 笔记】12-闭包
Unity editor expansion - the framework and context of unity imgui
Image processing 8-cnn image classification
Downward compatibility and upward compatibility
[rust notes] 05 error handling
Unity editor expansion - window, sub window, menu, right-click menu (context menu)
[updating] wechat applet learning notes_ three
OpenGL learning notes
Constraintlayout's constraintset dynamically modifies constraints
单调栈-84. 柱状图中最大的矩形
Conversion between golang JSON format and structure
Use of ue5 QRcode plug-in
[cloud native] introduction and use of feign of microservices
Osgearth topographic shading map drawing
Initial unity
Unity editor expansion - the design idea of imgui
Un système de gestion de centre commercial pour la conception de cours de technologie d'application de base de données