Most of the structures of database management systems are "relational structures". The relationship structure is an unformatted structure that uses a single two-dimensional table structure to represent entities and the relationships between entities. The relational structure organizes data in the form of record groups or data tables to facilitate storage and transformation using the relationships between various entities and attributes. It does not have hierarchies or pointers. It is a way to establish the relationship between spatial data and attribute data. Very efficient way to organize data.
The operating environment of this tutorial: Windows 7 system, Dell G3 computer.
Most of the structures of database management systems currently used are "relational structures".
Relationship structure, also known as "relationship model", refers to a data model that expresses entities and relationships between entities in the form of a two-dimensional table.
Three basic data models have been produced in the data development process, which are hierarchical model, network model and relational model. These three models are named according to their data structures. The first two use formatted structures. In this type of structure, entities are represented by records, and records are abstracted as vertices of the graph. The connection between record types is abstracted as the connection arc between vertices. The entire data structure corresponds to the graph. The basic structure of the hierarchical model is a tree structure; the basic structure of the network model is an undirected graph without any restrictions. The relational model is an unformatted structure that uses a single two-dimensional table structure to represent entities and the relationships between entities. The relational model is a commonly used data model in current databases.
Relationship model: Organize data in the form of record groups or data tables to facilitate storage and transformation using the relationships between various entities and attributes. There is no hierarchy or pointers. It is a very effective data organization method to establish the relationship between spatial data and attribute data.
There are thirteen basic concepts and basic terms of the relational model. They are:
(1) Relationship: A relationship corresponds to a two-dimensional Table, two-dimensional table is the name of the relationship.
(2) Tuple: A row in a two-dimensional table is called a tuple.
(3) Attribute: Columns in a two-dimensional table are called attributes. The number of attributes is called the element or degree of the relationship. The value of the column is called the attribute value;
(4) (Value) Domain (Domain): The value range of the attribute value is the value domain.
(5) Component: The attribute value of the column corresponding to each row, that is, an attribute value in the tuple. [2]
(6) Relational schema: The row definition in the two-dimensional table, that is, the description of the relationship is called the relational schema. It is generally expressed as (attribute 1, attribute 2,..., attribute n). For example, the relationship model of a teacher can be expressed as a teacher (teacher number, name, gender, age, professional title, department).
(7) Key (code): If there is an attribute or set of attributes that uniquely identifies an entity in a relationship, it is called the key of the entity, that is, two keys in any relationship state of the relationship A tuple in which all combinations of values on this attribute are different.
(8) Candidate key (candidate code): If the value of a certain attribute in the relationship can uniquely identify a tuple, if no attribute can be removed in a key of the relationship, otherwise it is not this The key of a relationship is called the specified candidate key as the candidate key or candidate code of the relationship.
For example, in the following student table, "student number" or "library card number" can uniquely identify a tuple, then "student number" and "library card number" can both uniquely identify a tuple, then Both "student number" and "library card number" can be used as candidate keys for student relationships.
Student number |
Name |
Gender |
Age |
Library card number |
Department |
S3001 |
Zhang Ming |
Male |
##22 |
B20050101 | foreign language |
李京 | 女 | 21 | B20050102 | foreign language | |
Zhao Li |
|
21 | B20050301 | Management |
In the course selection table, only the attribute group "student number" and "course number" can uniquely identify a tuple, then the candidate key is (student number, course Number).
Student ID |
Course ID |
S3001 |
C1 |
##S3001 | C2 |
S3002 | C1 |
S4001 | C3 |
Three types of integrity rules for relational models
1. Entity integrity rulesThis rule requires that the tuples in the relationship must be There cannot be a null value on the attribute. If there is a null value, the primary key value cannot uniquely identify the tuple. 2. Referential integrity rulesIf the attribute set K is the primary key of the relationship schema R1, and K is also the foreign key of the relationship schema R2, then in the relationship R2, the value of K is only Two possibilities are allowed, either a null value, or equal to a primary key value in the R1 relationship.Advantages of the relational model
(1) Single data structureIn the relational model, whether it is an entity or a connection between entities, Represented by relationships, each relationship corresponds to a two-dimensional data table, and the data structure is simple and clear. (2) The relationship is standardized and established on a strict theoretical basis. The basic norms that constitute the relationship require that each attribute in the relationship cannot be divided, and the relationship is established on a solid theoretical basis. based on strict mathematical concepts. (3) Simple concept and easy operationThe biggest advantage of the relational model is its simplicity, which is easy for users to understand and master. A relationship is a two-dimensional table, and users only need to use simple query language. Able to operate the database. For more related knowledge, please visit theFAQ column!
The above is the detailed content of What is the structure of most database management systems currently used?. For more information, please follow other related articles on the PHP Chinese website!