MS SQL Basics Tutorial: A paradigm of relational databases

Source: Internet
Author: User
Tags requires

The construction of the database must follow certain rules. In a relational database, this rule is a paradigm. A paradigm is a collection of relational patterns that conform to a certain level. Relationships in relational databases must meet certain requirements, that is, to satisfy different paradigms. There are six types of relational databases: first paradigm (1NF), second normal form (2NF), third normal form (3NF), fourth normal form (4NF), v Paradigm (5NF) and sixth paradigm (6NF). The paradigm that satisfies the minimum requirement is the first paradigm (1NF). Further satisfying more requirements on the basis of the first paradigm is called the second normal form (2NF), and the remaining paradigms are referred to as the second analogy. Generally speaking, the database only needs to satisfy the third normal form (3NF) on the line. Here are examples of first paradigm (1NF), second Normal (2NF), and third Normal (3NF).

3.4.1 First Paradigm (1NF)

In any relational database, the first normal form (1NF) is the basic requirement of the relational schema, and the database that does not satisfy the first normal form (1NF) is not a relational database.

The so-called first normal form (1NF) means that each column of a database table is an indivisible basic data item and cannot have multiple values in the same column, that is, an attribute in an entity cannot have more than one value or cannot have duplicate attributes. If duplicate attributes occur, you may need to define a new entity, which consists of duplicate attributes and a one-to-many relationship between the new entity and the original entity. In the first normal form (1NF), each row of the table contains information about only one instance. For example, for the Employee Information table in Figure 3-2, you cannot display employee information in a column, or two or more columns in one column; Each row of the employee Information table represents only one employee's information, and one employee's information appears only once in the table. In short, the first paradigm is a column without duplicates.

3.4.2 Second Normal form (2NF)

The second normal form (2NF) is established on the basis of the first normal form (1NF), that is, satisfying the second normal form (2NF) must first satisfy the first normal form (1NF). The second normal form (2NF) requires that each instance or row in a database table must be divided into unique regions. For implementation differentiation it is often necessary to add a column to the table to store the unique identities of individual instances. Such as

Figure 3-2 The Employee Information table adds the employee number (emp_id) column, because each employee's employee number is unique, so each employee can be uniquely differentiated. This unique property column is called the primary key or primary key, and the primary code.

The second normal form (2NF) requires that the attributes of an entity depend entirely on the primary keyword. Total dependency refers to an attribute that cannot exist only on a part of the primary key, and if so, this part of the attribute and the primary key should be separated to form a new entity, a one-to-many relationship between the new entity and the original entity. For implementation differentiation it is often necessary to add a column to the table to store the unique identities of individual instances. In short, the second paradigm is that non-primary attributes are dependent on the primary keyword.

3.4.3 Third paradigm (3NF)

Satisfying the third normal form (3NF) must first satisfy the second normal form (2NF). In short, the third normal form (3NF) requires that a database table not contain non-primary key information already contained in other tables. For example, there is a departmental information table in which each department has information such as department number (dept_id), department name, department profile, and so on. So in Figure 3-2

's Employee Information table, the department's name, department profile, and other department-related information can no longer be added to the Employee Information table. If the departmental information table is not present, it should also be built according to the third normal form (3NF), otherwise there will be a large amount of data redundancy. In short, the third paradigm is that attributes are not dependent on other non-primary attributes.

View a complete set of "MS SQL Primer Tutorials" >>>>>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.