Image understanding the three main paradigms of relational database

Source: Internet
Author: User

The next step is to explain each level of the paradigm, first The first paradigm (1NF).
Conforms to the 1NF relationship (you can understand it as a data table.) The difference between "relationship" and "relationship pattern" is similar to the difference between "class" and "Object" in object-oriented programming. "Relationship" is an example of "relational pattern", you can understand "relationship" as a table with data, and "relational mode" is the table structure of this data table. 1NF is defined as: each attribute in a relationship that conforms to 1NF cannot be divided. Table 1As shown in the case, it does not meet the requirements of 1NF.

Table 1

As a matter of fact 1NF is the most basic requirement for all relational databases, when you create a data table in a relational database management system (RDBMS), such as SQL Server,oracle,mysql, the operation must not be successful if the data table is not designed to meet this basic requirement. That is, as long as the data table already exists in the RDBMS, it must be 1NF compliant. If we want to show the data in the RDBMS, we have to design Table 2In the form of:

Table 2

However, only 1NF design, there will still be too large data redundancy, insert the exception, delete the exception, modify the problem of the exception, for example, Table 3In the design:

Table 3: Note .....
    1. Each student's school number, name, department name, dean of the data are repeated several times. The data for each department and the corresponding Dean are repeated multiple times- too much data redundancy
    2. If the school has a new department but has not enrolled any students for the time being (for example, it was created in March, but not until August), it is not possible to add the data of the department name and the dean to the data sheet separately (note 1)-- Insert Exception

      Note 1: According to the requirements of entity integrity in three relationship integrity constraints, the code in the relationship (note 2) cannot be empty, and the combination of all attributes cannot be duplicated. In order to meet this requirement, the table in the diagram can only use the combination of the study number and the class name as the code, otherwise it will not be possible to divide each record in a unique region.

      NOTE 2: code: A property in a relationship or a combination of several attributes that distinguishes each tuple (a tuple can be understood as each record in a table, that is, each row).
    3. If the records of all the students in a department are deleted, then the data of all the department and department heads disappears (none of the students in the department does not mean that the department is gone). -- Delete exception
    4. If Ted Physico to the law department, then in order to ensure the consistency of data in the database, we need to revise three records of the Department and department director of the data. -- Modify the exception .
Because only 1NF database design has such problems, we need to improve the design standards, to eliminate the factors that lead to the above four problems, so that they conform to a higher-level paradigm (2NF), which is called "normalization."

Image understanding the three main paradigms of relational database

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.