1. Introduction Introduction to Database Systems

Disclaimer: This article is a blogger original article, follow the CC 4.0 by-sa copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/weixin_43812140/article/details/97027575

1.1 Database System Overview

4 basic database concepts 1.1.1

Data : records of a transaction descriptor;
database : set within the computer, organized, long-term storage can be shared large amounts of data; data in the database according to certain organizational data model, described and storage, has a smaller redundancy , higher data independence and easy scalability, can be shared for various users;
database management system : one is located between the user data management system and the operating system, its main functions include: ① data defining features such as data Definition language (DDL) ② data organization, establishing and maintaining transaction management functions to store and manage data manipulation functions ③ ④ ⑤ operation and management of the database and the database ⑥ other functional
database system: databases, database management systems (and application development tools) , storage applications and database administrator (DBA) composition, management, and maintenance of data processing systems.

Features 1.1.2 database

Structured data : the database system to achieve the overall structure of the data, which is one of the main characteristics of the database, but also the essential difference between a database system and file system; "whole" refers to structured data in the database is no longer just for one application but for the entire organization or enterprise; not only internal data is structured, it is a link between the data.
Data sharing high and low redundancy easy to expand : the data sharing can significantly reduce data redundancy and save memory space; further data sharing and to avoid incompatibility between data inconsistency; elasticity which makes database system , easy to expand.
High data independence : independent data independence, including physical, logical independence; physical independence refers to the user applications and the physical storage of data in the database are independent of each other; logic Independence: the logical structure of the user database applications and They are independent of each other.
Unified management and control of data by the database management system : a database management system provides data security protection: protection to prevent data integrity checks have been caused by illegal use of data leaks and destruction of data: data correctness effectiveness compatibility , concurrency control, the database recovery.
The database is an organized long-term storage in a computer, a large, shared data collection . He can be used for a variety of users to share, with a minimum redundancy and high data independence. Database management system database build, use and maintenance of the database is a unified control, to ensure the integrity and security of data, and concurrency control when multiple users simultaneously using the database, the database recovery after a failure.

1.2 Data Model

1.2.1 The two types of data model

Conceptual model : also known as the information model, according to the user point of view of data and information modeling, mainly for database design.
Logical and physical models : hierarchical model comprises a logical model, the mesh model, the relational model, object-oriented data model, object-relational model, semi-architected models, views a computer system according to the logic model to the data model, primarily used for database management system implemented; physical model is a bottom abstract data that describes data representation within the system and an access method or access method and storage on disk or tape, is for the computer system, database designers to understand and select the physical model.
The process of establishing the approximate model shown in Figure 1:
Here Insert Picture Description

1.2.2 Conceptual Model

The basic concept of information in the world:
Entity : the objective existence of things can be distinguished from each other entities called.
Properties : entity having certain properties called attributes.
Code : The only attribute indicates an entity called a code set.
Entity type : a property name and property name and describe the same set of abstract entity called entity type.
Entity set : a collection of unified type of entity is called an entity set.
Contact : Contact between the entities usually have one to one, one to many, many to many other types.
Conceptual model can be used entity - indicates contact method, also known as ER diagrams.

Constituent elements 1.2.3 Data Model

Data structures : composition described link between objects and object database.
Operating data : Example (values) of various objects in the database (model) is allowed to perform a set operation of the brain and wide operating rules of operation. (CRUD)
integrity constraints data : a set of integrity rules.

1.2.4 Common Data Model

Main logical model has : hierarchical model, the mesh model, the relational model, object-oriented data model, data on the correlation model, semi-structured data model.
Formatted model : hierarchical model, mesh model of
the basic unit formatted model data structure is substantially level contact ; refers to a basic level Contact many links between records and two (including one) of.

1.2.5 Hierarchical Model

Configuration example illustrated in FIG substantially:
Here Insert Picture Description
the data structure of the hierarchical model :
1. There is only one parent node is not the node, this node is called the root node;
other nodes other than the root of 2. There is only one parent node point;
3. each node represents a record type, hierarchical model can only handle so many relationship.
Data manipulation of the hierarchical model and integrity constraints :
1. insertion operation, if there is no response to the value of the parent node can not be inserted to its child node value;
2. delete operation, if the parent node to delete value, value corresponding child node will also be deleted.
Advantage of the hierarchical model :
data structures 1. The hierarchical model is relatively simple and clear;
high query rate 2. level database;
3. hierarchical model provides a good support integrity.
Disadvantage of the hierarchical model :
1. Contact the reality of many non-hierarchical world, many relationships do not apply;
2. if a parent node having a plurality of nodes, etc., in a hierarchical model represents this type of contact is very clumsy, by introducing only a book (easy to produce inconsistency) or create unnatural data structure (introducing virtual nodes) to resolve. Restrictions on the insert and delete operations more;
3. child node must query by parents;
tight 4. structured, tends to command procedures.

1.2.6 Network Model

网状模型的大致结构如图所示:
Here Insert Picture Description
网状模型的数据结构
1.允许一个以上的结点无双亲;
2.一个结点可以有多于一个的双亲;
3.每个结点表示一个记录类型;
4.网状模型中子女结点与双亲结点的联系可以不唯一。
网状模型的数据操纵与完整性约束
1.支持记录码的概念;
2.保证一个联系中双亲记录和子女记录之间是一对多的联系;
3.可以支持双亲记录和子女记录之间的某些约束条件。
网状模型的优点
1.能更为直接的描述现实世界;
2.具有良好的性能,存取效率较高。
网状模型的缺点
1.结构较为负责;
2.网状模型的DDL、DML复杂,并且需要嵌入某一种高级语言中;
3.由于记录之间的联系是通过存取路径实现的,应用程序在访问数据时必须选择适当的存取路径,所以用户需要了解系统的结构的细节,不利于开发与使用。

1.2.7关系模型

关系模型的大致结构如图所示:
Here Insert Picture Description
关系模型的数据结构
关系:一个关系对应通常说的一张表;
元组:表中的一行即为一个元组;
属性:表中的一列即为一个属性;
:也称为码键,表中的某个属性组可以唯一确定一个元组,就为码;
:一组具有相同数据类型的值的集合;
分量:一个元组中的一个属性值;
关系模式:对关系的描述,一般格式:关系名(属性1,属性2…)
关系模型要求关系必须是规范化的,关系的每一个分量必须是一个不可分的数据项。
关系模型的优点
1.数据结构单一
关系模型中,不管是实体还是实体之间的联系,都用关系来表示,而关系都对应一张二维数据表,数据结构简单、清晰。
2.关系规范化,并建立在严格的理论基础上
构成关系的基本规范要求关系中每个属性不可再分割,同时关系建立在具有坚实的理论基础的严格数学概念基础上。
3.概念简单,操作方便
关系模型最大的优点就是简单,用户容易理解和掌握,一个关系就是一张二维表格,用户只需用简单的查询语言就能对数据库进行操作。
关系模型的缺点:
由于存储路径对用户隐蔽,查询效率低于格式化数据模型,为提高性能,需要开发人员对用户请求进行优化。

1.3数据库系统的结构

1.3.1数据库系统模式的概念

:对某一类数据的结构和属性的说明;
:型的一个具体赋值;
模式:数据库中全体数据的逻辑结构和特征的面熟,仅仅涉及型的描述,不涉及具体的值;
实例:模式的一个具体值,同一个模式可以有多个实例;
模式是相对稳定的,实例时相对变动的。

1.3.2数据库系统的三级模式

数据库领域公认的标准结构是三级模式结构,它包括外模式、概念模式、内模式,有效地组织、管理数据,提高了数据库的逻辑独立性和物理独立性。用户级对应外模式,概念级对应概念模式,物理级对应内模式,使不同级别的用户对数据库形成不同的视图。所谓视图,就是指观察、认识和理解数据的范围、角度和方法,是数据库在用户“眼中"的反映,很显然,不同层次(级别)用户所“看到”的数据库是不相同的。
外模式
外模式又称子模式或用户模式,对应于用户级。它是某个或某几个用户所看到的数据库的数据视图,是与某一应用有关的数据的逻辑表示。外模式是从模式导出的一个子集,包含模式中允许特定用户使用的那部分数据。用户可以通过外模式描述语言来描述、定义对应于用户的数据记录(外模式),也可以利用数据操纵语言(Data Manipulation Language,DML)对这些数据记录进行操作。外模式反映了数据库系统的用户观。
概念模式
概念模式又称模式或逻辑模式,对应于概念级。它是由数据库设计者综合所有用户的数据,按照统一的观点构造的全局逻辑结构,是对数据库中全部数据的逻辑结构和特征的总体描述,是所有用户的公共数据视图(全局视图)。它是由数据库管理系统提供的数据模式描述语言(Data Description Language,DDL)来描述、定义的。概念模式反映了数据库系统的整体观。
内模式
内模式又称存储模式,对应于物理级。它是数据库中全体数据的内部表示或底层描述,是数据库最低一级的逻辑描述,它描述了数据在存储介质上的存储方式和物理结构,对应着实际存储在外存储介质上的数据库。内模式由内模式描述语言来描述、定义的。内模式反映了数据库系统的存储观。
在一个数据库系统中,只有唯一的数据库, 因而作为定义 、描述数据库存储结构的内模式和定义、描述数据库逻辑结构的模式,也是唯一的,但建立在数据库系统之上的应用则是非常广泛、多样的,所以对应的外模式不是唯一的,也不可能是唯一的。
Here Insert Picture Description

1.3.3数据库的二级映像功能与数据独立性

外模式/模式映像:每个外模式都有一个与之对应的外模式/模式映像,一个数据库有多个该模式,当模式改变时,有数据库管理员对各个外模式/模式的映像作为改变,可以使外模式不变,因为应用程序根据外模式编写,这样保证了数据与程序的逻辑独立性;
模式/内模式映像:数据库中模式/内模式是唯一的,当数据库的存储结构改变时,有数据库管理员对模式/内模式映像做出相应改变,可以使模式保持不变,从而应用程序也不必改变,保证了数据与程序的物理独立性。

1.4数据库系统的组成

1. The database (database, DB) is a collection of long-term storage in the computer, organized, shareable data. Data in the database according to a certain mathematical model of organization, description and storage, has less redundancy, higher data independence and ease of scalability, and can be shared by various users.
2. Hardware : a variety of physical devices constituting a computer system, including the external storage equipment required. Hardware configuration should meet the needs of the entire database system.
3. Software : including operating systems, database management systems and applications. DBMS (database management system, DBMS) software is the core database system, is working with the support of the operating system to address how to organize and store scientific data, how efficient the system software acquisition and maintenance data. Its main features include: data definition, data manipulation functions, establishment and maintenance of database management and operation of the database.
4. art : There are four main categories. The first category is systems analysts and database designers: System Analyst responsible for application system requirements analysis and specification, and their users and database administrators determine the hardware configuration of the system together, and participate in preliminary design of the database system. Determine the database designer in charge of the data in the database, the database design patterns at all levels. The second category is the application programmer is responsible for writing applications that use the database. These applications can retrieve the data, created, deleted or modified. The third category is the end users, who use the system interface or query language to access the database. The fourth category is the user database administrator (data base administrator, DBA), responsible for the overall control of the database information. DBA's specific responsibilities include: specific information content and structure of the database, the storage structure and access strategy decisions database, security requirements defined in the database and the integrity constraints, to monitor the use and operation of the database, the database is responsible for performance improvement, restructuring and reconstruction of the database to improve the performance of the system.

Guess you like

Origin blog.csdn.net/weixin_43812140/article/details/97027575