Database pattern

xiaoxiao2021-03-06  48

Constructing the database must follow certain rules. In the relational database, this rule is paradigm. Paradigm is a collection of relationship modes that meet a certain level. The relationship in the relational database must meet certain requirements, that is, meet different paradigms. The current relational database has six paradigm: the first paradigm (1NF), a second parameter (2nF), a third paramode (3NF), the fourth paradiglass (4NF), the fifth parameter (5nf), and sixth paradigm (6nf). A paradord that satisfies the minimum requirement is the first paradigm (1nF). On the basis of the first paradigm, more requirements are further satisfied as the second paradigm (2nf), and the remaining formula is pushed by secondary. Generally speaking, the database only needs to meet the third paradigm (3NF). Let us exemplify the first paradigm (1NF), the second paradigm (2NF), and the third paradigm (3NF). The first paradigm (1NF) is in any relational database, the first paradigm (1nf) is the basic requirement of the relational mode, and the database does not satisfy the first paradigm (1NF) is not a relational database. The first paradigm (1nf) means that each column of the database is an indivisible basic data item. There is no multiple values ​​in the same column, that is, some attributes in the entity cannot have multiple values ​​or cannot have repetitive properties. . If you have a repetitive property, you may need to define a new entity, and the new entity is constructed by the repetitive properties, and the new entity and the original entity are one-to-many relationship. Each row in the first paradigm (1nf) contains only one instance of information. For example, for the employee information table in Figure 3-2, the employee information cannot be displayed in a column, and two columns or multiple columns cannot be displayed in one column; each row of employee information tables represents only one employee Information, an employee information only once in the table. In short, the first paradigm is a repeated column.

The second parameter (2nf) second parameter (2nf) is established on the basis of the first paramode (1nf), i.e., satisfying the second paraness (2nf), must first satisfy the first paraness (1nf). The second paradigm (2nf) requires each instance or line in the database table must be unique. To achieve a distinction, you usually need to add a column to the table to store the unique identity of each instance. As the employee information table, the employee number (EMP_ID) column is added, because each employee number is unique, so each employee can be unique. This unique attribute column is called the primary key or primary key, the master code. The second paradigm (2nf) requires the property of the entity to depend all on the primary keyword. The so-called complete dependence means that there is no attribute that relies only a part of the master keyword, if there is, this part of this attribute and the primary key should be separated to form a new entity, and the new entity is a one more and more. relationship. To achieve a distinction, you usually need to add a column to the table to store the unique identity of each instance. Briefly, the second paradigm is non-primary attribute non-part dependent on the primary keyword.

转载请注明原文地址:https://www.9cbs.com/read-59467.html

New Post(0)