当前位置:网站首页>Database overview

Database overview

2022-06-25 04:54:00 Cn Sirius

Show the world , The information world , Machine world

Three worlds Real world The information world Machine world
Yes The individual of things Entity Record
Should be Things as a whole Entity set file
Turn off Characteristics of things attribute Field
system The connection between things conceptual model Data model

Three level mode Secondary independence Secondary image

Three level mode

Three level mode External mode Pattern Internal mode
Corresponding level User level Concept level Physical level

Enable users at different levels to form different views of the database .

Secondary image

External mode - Pattern

Ensure logical independence of data

There can be any number of external modes for the same mode , For every outer pattern , Database systems all have an external schema / Pattern image .
When the pattern changes , The database administrator controls each external mode / Change the image of the pattern accordingly , You can keep the outer mode unchanged . The application program is written in an external mode of data , So the application doesn't have to be modified , Ensure the independence of data and program , The logical independence of data .

Pattern - Internal mode

Ensure the physical independence of data and program , Physical independence of data .

There is only one schema in the database , There is only one internal mode , So the pattern / Internal mode image is unique . This image definition is usually included in the schema description
When the storage structure of the database changes ( That is, the internal mode changes ), The database administrator modifies the schema / Internal mode image , Leave the mode unchanged . Application is not affected , Ensure the physical independence of data and program , Physical independence of data .

Primary key Foreign keys

create table a(
	a1 primary key,// Primary key 
	a2
	);
create table b(
	b1,
	foreign key(b1) references a(a1),// Primary foreign key Association 
	);

The concept of code classification

Code is a basic concept in data system . A code is an attribute that uniquely identifies an entity , He is the property of the whole entity set , Not the nature of a single entity .
Definition of candidate code : If the value of an attribute group in the relationship can uniquely identify a primitive ancestor , The attribute group is called candidate code ;
Definition of master code : If a relationship has multiple candidates , Select one of the main codes ;
Main attribute definition : The attributes of candidate codes are called primary attributes ;
Non primary attribute definition : Attributes that are not included in any candidate code are called non primary attributes ;
Entity integrity rules : If the property ( An attribute or set of attributes )A It's the basic relationship R The main attribute of , be A Can't take null value .

原网站

版权声明
本文为[Cn Sirius]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202210531492483.html