http://wiki.mbalib.com/wiki/Data Model
Data model
Edit
A data Model is an abstraction of a real-world data feature that describes the concept and definition of a set of data. Data model is the storage method of data in database, and it is the base of database system. In the database, the physical structure of the data is also called the data storage structure, which is the representation and configuration of the data elements in the computer memory; The logical structure of data refers to the logical relationship between data elements, which is the representation of data in front of users or programmers, and the storage structure of data is not necessarily consistent with the logical structure.
Edit
The research of the data model includes the following three aspects:
-
1. Conceptual Data Model
This is a database user-oriented real-world data model, mainly used to describe the conceptual structure of the world, it makes the database designers in the initial stage of design, the computer system and database management systems to get rid of the specific technical problems, focus on the analysis of data and the relationship between the data, and the specific database management system independent. The conceptual data model must be converted into a logical data model to be implemented in a database management system.
-
2. Logical Data Model
This is the data model that the user sees in the database, is the data model supported by the specific database management system, there are three types of mesh data model, hierarchical data model and relational data model. This model is both user-oriented and system-oriented, which is mainly used for the realization of database management system. In the database, the data model is used to abstract, represent and deal with the data and information in the real world, mainly to study the logical structure of the data.
-
3. Physical Data Model
This is a data model describing the organization structure of data on storage media, which is related not only to the specific database management system, but also to the operating system and hardware. Each logical data model has a physical data model that corresponds to it when it is implemented. In order to ensure the independence and portability of the database management system, the implementation of most of the physical data model is automatically completed by the system, and the designer only designs indexes, aggregates and other special structures.
Edit
-
1. Division of Three Worlds
Data processing is a gradual transformation process, through the real world, the information world and the computer world of these 3 different worlds, experienced two levels of abstraction and transformation.
-
(1) The real world
The real world refers to the existence of things and their relationship with each other. Things in the real world have a lot of characteristics and inextricably linked, but people only choose part of the interest to describe, such as students, people usually use the number, name, class, performance and other characteristics to describe and distinguish, and for height, weight, looks not too concerned about, and if the object is an actor, it may be exactly the opposite. Things can be concrete, visible objects, or abstract things.
-
(2) Information world
The information world is a kind of abstract world, which is composed of the information and connection of the real world, which is recorded by "symbol" and then the description is defined by the standardized database definition language. The information world is actually an abstract description of the real world. In the information world, it is not simply to symbolize the real world, but to produce a conceptual model by sifting, summarizing, summarizing, naming, and so on, to represent the abstraction and description of the real world.
-
(3) Computer World
The computer world is the product of the content data of the information world. The conceptual model in the information world is further transformed into a data model, which forms a data representation which is convenient for computer processing.
-
2. Three elements of the data model
The data model describes 3 parts, namely data structures, operations, and data constraints.
-
(1) Data structure
The data structure is used to describe the static characteristics of the system, including the type, content, nature and the connection between the data. It is the basis of the data model and the most important aspect of characterizing the nature of a data model. In a database system, people usually name the data model according to the type of its data structure. For example, the hierarchical model and relational model data structures are hierarchical structure and relational structure respectively.
-
(2) Data manipulation
Data manipulation is used to describe the dynamic characteristics of a system, including inserting, modifying, deleting, and querying data. The data model must define the exact meaning of these operations, the operation symbols, the rules of operation, and the language that implements the operation.
-
(3) Data constraints
The constraint of the data is actually a set of integrity rules. Integrity rules are the constraints and storage rules of data in a given data model and their relationships, to limit the changes of databases and their states that conform to the data model to ensure the correctness, validity and compatibility of the data. For example, restricting a table secondary number cannot be duplicated, or the age value cannot be negative, which is an integrity rule.
Edit
The type of database is divided according to the data model, and any DBMS is designed according to the data model, which means that the database must be organized into a data model conforming to the DBMS. At present, the data models used in the database system are: Hierarchical model, network model and relational model. The fundamental difference between them is the way data is represented differently (that is, the type of contact between the records is different). A hierarchical model represents a relationship between data in a "tree structure". A mesh model is a "graph structure" that represents the connection between data. A relational model is a "two-dimensional table" (or a relationship) that represents the connection between data.
-
1. Hierarchical Model (hierchical)
Hierarchical model is one of the earliest models used in database system, and its data structure is a "tree with direction". The root node is at the top, the highest level, the sub-nodes are under, arranged by layers. The characteristics of a hierarchical model are:
- There is only one node with no parent node, it is the root node;
- Other nodes have and have only one parent node. The figure shows a hierarchical data model of the Department of Educational Administration, and figure (a) shows the linkages between entities, as shown in figure (b).
The most influential hierarchical model of DBS is the the late 1960s, IBM company launched the IMS Hierarchical model database system.
-
2. Network Model (Network)
The mesh model represents the connection between entities and entities in a mesh structure. Each node in the net represents a record type, which is implemented by linking pointers. The mesh model can represent the connection of multiple dependencies, or it can represent the intersection of data, that is, the horizontal relationship between the data and the vertical relationship, it is the extension of the hierarchical model. The mesh model can easily represent various types of connections, but the structure is complex and the algorithm is difficult to standardize. It is characterized by:
- Allow nodes to have more than one parent node;
- There can be more than one node without a parent node.
is shown as a Department of Educational management network data model.
-
3. Relational Model (Relation)
The relationship model is a two-dimensional table structure to represent the relationship between entities and entities, which is based on the relational mathematical theory. The data structure of a relational model is a collection of "two-dimensional table frames". Each two-dimensional table can also be called a relationship. In the relational model, both the object and the result of the operation are two-dimensional tables. The relational model is currently the most popular database model. The database management system supporting relational model is called relational database management system, and access is a relational database management system. The diagram shows a simple relational model in which figure (a) is shown as the relationship pattern, and figure (b) shows the relationship between the two relational models, the relationship name is the teacher relationship and the curriculum relationship, each relationship contains 3 tuples, and the main code is "teacher number".
- The consistency of the description is not only used to describe the entity itself, but also to describe the relationship between entities;
- Can directly express many-to-many links;
- The relationship must be a normalized relationship, that is, each attribute is an irreducible data item, and no table is allowed;
- The relationship model is based on the concept of mathematics and has a strong theoretical basis.
In the relational model, the basic data structure is a two-dimensional table, without a link pointer like a hierarchy or mesh. The relationship between records is reflected by the attributes of the same name in different relationships. For example, to find the course of the "lecturer" teacher, you can first find the teacher number "1984030" in the teacher relationship, and then find the course name corresponding to the "1984030" instructor number in the course relationship. Through the above query process, the property teacher number with the same name plays a role in connecting two relationships. It can be seen that the relationship model should not be isolated, nor a random patchwork of two-dimensional table, it must meet the corresponding requirements.
A relationship is a two-dimensional table, a collection of tuples. A relational framework is a property name table for a relationship. Formal representations are:
where R is the relationship name, andai(i=1,2,...,n) is the property name of the relationship.
Relationships are implemented through public attributes. For example, the figure shows two relationships, and the association between the two relationships is achieved through the teacher number public property.
A relational database is a collection of all the relationships that correspond to a relational model. For example, in an educational management relationship database, including teacher relations, curriculum relations, student relations, classroom relations, performance relations and so on.
Data Model and database