[DAO] database three paradigm description, dao Database paradigm

Source: Internet
Author: User

[DAO] database three paradigm description, dao Database paradigm
**************************************** ********************************* *** Original article: blog.csdn.net/clark_xu Xu changliang's column**************************************** ********************************

 

First paradigm: the general situation is that the column value is unique and there cannot be repeated column values (must comply );

Negative example:

Name contact information (string type)

Xxx 12345; abc@163.com

Xxx bcd@163.com

Xxx 12345; 67890; def@163.com

Hazard: junk data cannot be deleted or modified;

Correct design method:

Name phone number 1 phone number 2 phone number 3 phone number 4 mailbox

In the second paradigm, attributes fully depend on primary keys (must comply)

N must satisfy the first paradigm

N must have a primary key

N other columns must depend entirely on the primary key.

Incorrect table creation method:

No. Name: Gender major lesson

100 xxx m java 600

200 xxx f java 700

 

What violates paradigm 2 is another meaning. Placing two entities in the same table is not convenient for individual Maintenance of one entity data.

No. Name: Gender major lesson

100 xxx m java 600

200 xxx f java 700

 

Table 2

Number of professional courses

00001 java 600

002, java 700

3) third paradigm: attributes do not depend on other non-primary attributes

N must follow the second paradigm

N remove transfer Dependencies

The correct design method is:

No. Name gender major no.

100 xxx m 001

200 xxx f 002

 

Table 2

Number of professional courses

00001 java 600

002, java 700

 

Overview:

Paradigm 2: A table cannot contain information of two entities. It must contain one entity.

Paradigm 3: one entity cannot reference attributes of other entities. It can only reference primary keys of other entities.

Note:

In some cases, due to query efficiency considerations, it may violate paradigm 3. Redundancy is added. Table join is not required during query, which increases the execution efficiency of tables, however, the maintainability is reduced. It is generally not recommended that tables that are frequently maintained violate the third paradigm.

Related Article

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.