[Introduction to database systems] ---- relational database (1), Introduction to Database Systems
2.1 relational data structure and formal definition
A relational database system supports relational models.
A relational model consists of three parts: relational data structure, relational operation set, and Relational integrity constraint.
2.1.1 relationship
The data structure of a relational model is very simple. It only contains a single data structure-relational.
1. Domain: a set of values with System Data Types
2. Cartesian product:
For example, if A = {a, B}, B = {0, 1, 2}, AxB = {<a, o>, <a, 1>, <a, 2>, <B, 0>, <B, 1>, <B, 2>,} <a, 0> is a tuple.
A is a component.
3. Relationship: <a, 0> is the relationship on domain A * B. The number of subset A * B is the object or degree.
N = 1 this link is called a unit link.
N = 2 this relationship is called a binary relationship.
A link is a two-dimensional table. Each column corresponds to a name called an attribute.
The attribute group that uniquely identifies a tuples is called a candidate code.
If there are multiple candidate codes in the relationship, select one of them as the master code.
The attributes of candidate codes are called primary attributes, and others are called non-primary attributes or non-Code attributes.
In the simplest case, a candidate Code contains only one attribute. In extreme cases, all attributes are candidate codes, which are called full codes.
There are three types of links:
Basic Relationship (basic table or base table): It is an actually existing table, which is the logical representation of the actually stored data.
Query table: The table corresponding to the query result.
Visual chart: it is a table exported from a basic table or other icons, and it is a virtual table.
2.1.2 link mode
The link is actually a two-dimensional table, and the description of the link is called the link mode.
A link is the state or content of the link mode at a certain time point. The link mode is static and stable, while the link is dynamic and constantly changing over time.
2.1.3 Relational Database
Relational databases include:
Definition of several domains
Several relational modes defined on these domains
The value of a relational database is a set of links corresponding to these relational modes at a certain time point. It is usually called a relational database.