当前位置:网站首页>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
边栏推荐
- Conversion between string and int types in golang
- Why can void * be a general pointer
- Development material set
- Creation of osgearth earth files to the earth ------ osgearth rendering engine series (1)
- 二进制转十进制,十进制转二进制
- Graphics_ Learnopongl learning notes
- Gradle's method of dynamically modifying APK package name
- Installation of PHP FPM software +openresty cache construction
- Chocolate installation
- 796 · unlock
猜你喜欢

单调栈-503. 下一个更大元素 II

数据库原理期末复习

UE4 source code reading_ Mobile synchronization
![[MySQL] MySQL Performance Optimization Practice: introduction of database lock and index search principle](/img/b7/7bf2a4a9ab51364352aa5e0a196b6d.jpg)
[MySQL] MySQL Performance Optimization Practice: introduction of database lock and index search principle

MySQL 8

Base64和Base64URL

Dealing with duplicate data in Excel with xlwings

Solution détaillée de toutes les formules de fonction de transfert (fonction d'activation) du réseau neuronal MATLAB

php-fpm软件的安装+openresty高速缓存搭建

分配异常的servlet
随机推荐
Unity Editor Extension - Outline
[cloud native] introduction and use of feign of microservices
Encoding and decoding of golang URL
How does unity fixedupdate call at a fixed frame rate
数据库原理期末复习
[audio and video] ijkplayer error code
Huawei interview summary during the epidemic
animation
Get to know unity2 for the first time
Message pack in C deserializes array objects
ArrayList
Downward compatibility and upward compatibility
如何应对数仓资源不足导致的核心任务延迟
Dotween plug-in
Transmit pictures with Base64 encoding
Solution détaillée de toutes les formules de fonction de transfert (fonction d'activation) du réseau neuronal MATLAB
Kunlunbase meetup is waiting for you!
Sequence of map implementation classes
Advanced OSG collision detection
Unity editor expansion - draw lines