Home >Database >Mysql Tutorial >Introduce the three models of database

Introduce the three models of database

coldplay.xixi
coldplay.xixiforward
2021-01-18 09:14:464788browse

Introduce the three models of database

Related free learning recommendations: mysql video tutorial

Preface

The data model is the core of the database system. This article briefly introduces the three main database models.


1. Formatted model

The formatted model is the collective name for hierarchical model and network model

1. Hierarchical model

① The concept of hierarchical data model

The hierarchical model uses attribute structures to represent various types of entities and the relationships between entities The connection

② The data structure of the hierarchical model

Features:

  1. The parent of a node is unique ;
  2. Can only directly handle one-to-many entity relationships;
  3. Each record type can define a sorting segment, also called a code field;
  4. Any record value can only be sorted by Its full meaning can only be revealed when viewing its path;
  5. No child record value can exist independently from the parent record value.

③Data manipulation of hierarchical model

  • Query
  • Insert
  • Delete
  • Update

④Integrity constraints of the hierarchical model

  1. No corresponding parent knot If you delete the parent node, the corresponding child node value will also be deleted at the same time;
  2. During the update operation, all corresponding records should be updated to ensure that the data consistency.
⑤Advantages and disadvantages of hierarchical model

    Advantages
  • The data structure of hierarchical model is relatively simple and clear;

    Query High efficiency, performance is better than the relational model, no less than the network model;
    The hierarchical data model provides good integrity support.

  • Disadvantages
  • The many-to-many relationship between nodes is unnatural;

    There are many restrictions on insertion and deletion operations, and the writing of the application is relatively complicated;
    Querying child nodes must go through parent nodes;
    Hierarchical commands tend to be procedural;

2. Network model

①The concept of network model

The network database system uses the network model as the organization method of data

✧The typical representative is the DBTG system:
■Also known as CODASYL system ■A system solution proposed by DBTG in the 1970s
Must be an actual system
■Cullinet Software's IDMS
■Univac's DMS1100
■Honeywell's IDS/2
■HP Company’s IMAGE

②Network model data structure

A collection of basic level connections that meet the following two conditions:

Allows more than one node to have no parents;
  1. A node can have more than one parent.
  2. Representation method (same as hierarchical data model)

Entity type: described by record type
    Each node represents - a record type (entity)

  • Attributes: Use field descriptions
  • Each record type can contain thousands of fields

  • Contact: Use the connection between nodes to represent a pair between record types (entities) More father-son relationships
③Network model manipulation and integrity constraints

Network database systems (such as DBTG) add

to data manipulation Some restrictions are provided and certain integrity constraints are provided

■Code: A collection of data items that uniquely identifies the record
■There is a one-to-many relationship between the parent record and the child record in a relationship
■ Supports certain constraints between parent records and child records

④Advantages and disadvantages of the mesh model

Advantages
    a. Can be more direct Describe the real world accurately, for example, a node can have multiple parents
  • b. It has good locality and high access efficiency

    Disadvantages
  • a. The structure is relatively complex, and it changes with the application environment As the database expands, the database becomes more and more complex, which is not conducive to the end user's grasp
  • b. DDL and DML languages ​​are complex and difficult for users to use
    c. The connection between records is achieved through access paths, and users It is necessary to understand the details of the system structure

3. The difference between the network model and the hierarchical model

■The network model allows multiple nodes without parent nodes

■The network model allows a node to have multiple parent nodes

■The network model allows multiple connections (composite connections) between two nodes
■The network model can be described more directly Real world
■The hierarchical model is actually a special case of the network model

2. Relational model

①The concept of the relational model

The relational database system uses the relational model as the organization method of data

In 1970, E.F. Codd, a researcher at the SanJose Research Laboratory of IBM Corporation in the United States, first proposed the relational model of the database system
Computer Almost all new database management systems launched by manufacturers support the relational model

②The data structure of the relational model

From the user's perspective, the logical structure of data in the relational model is a two-dimensional table, which consists of rows and columns.

  • Relation (Relation)
    ●A relationship corresponds to a usually said table

  • tuple( Tuple)
    ●A row in the table is a tuple

  • Attribute (Attribute)
    ●A column in the table is an attribute, give each attribute a A name is the attribute name

  • Main code (Key)
    ●Also called code key. A certain attribute group in the table, which can uniquely determine a tuple

  • Domain (Domain)
    ●Is a set of values ​​with the same data type. The value range of an attribute comes from a domain.

  • Component
    ●One attribute value in the tuple.

  • Relationship model ●Description of the relationship Relationship name (attribute 1, attribute 2,,. attribute n) Student (student number, name, age, gender, department name, grade)

The relationship must be standardized and meet certain constraints
The most basic constraint: Each component of the relationship must be an indivisible data item, and no other components in the table are allowed. Table

Introduce the three models of database

③Manipulation and integrity constraints of the relational model

  • Data operations are set operations, operation objects and operations The results are all relations
    ■Query
    ■Insert
    ■Delete
    ■Update
  • The access path is hidden from the user, and the user only needs to point out "What's the matter, no need to explain in detail" How to do it"
  • Relationship integrity constraints
    ■Entity integrity
    ■Referential integrity
    ■User-defined integrity

④Advantages and disadvantages of relational database

    ##Advantages
  • 1. Based on strict mathematical concepts
    2. Single concept
    ●Entities and various relationships are Represented by relationships
    ●The data retrieval results are also relationships
    3. The access path of the relational model is transparent to the user
    ●Has higher data independence and better security and confidentiality
    ●Simplifies the work of programmers and the work of database development and establishment
  • Disadvantages
  • 1. The access path is transparent to users, and the query efficiency is often not as good as the formatted data model
    2. In order to improve performance, it must Optimizing user query requests increases the difficulty of developing database management systems

Summary

The current research work in the database field is based on The relational method is the basis, so everyone should focus on the relational database when learning databases.

More related free learning recommendations: mysql tutorial(Video)

The above is the detailed content of Introduce the three models of database. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete