Three Paradigms of database

Source: Internet
Author: User

When designing a relational database, it is necessary to conform to different specification requirements to design a reasonable relational database, which are called different paradigms.

The role of the paradigm:< reduce the redundancy of data in >< databases >,< increase the consistency of >< data;.

There are currently six paradigms for relational databases: the first paradigm (1NF), the second paradigm (2NF), the third paradigm (3NF), the bath-cod paradigm (BCNF), the fourth paradigm (4NF) and the fifth paradigm (5NF, also known as the perfect paradigm).

First Paradigm
database table < Each column >< is >< indivisible >< atomic data, but not < set >,< array >,< record > etc < non-atomic data >.
That is, you cannot have more than one value in the same column.
It determines the "atomicity" of the attributes in the relational table.
Like a relationship with a property "wage" includes base pay and performance wage
Wages
-----------------------
Base salary performance wage
This relationship does not satisfy the first paradigm (in fact, in a relational database, all relationships meet the requirements of the first paradigm, and a database that does not meet the first paradigm is not called a relational database. )

The concept of the second paradigm is
The second paradigm is developed on the basis of the first paradigm,<< non-primary key attribute column >> must << full function dependency >> << primary key column field >> It cannot be related to only one part of the primary key column (primarily for federated primary keys).

The second paradigm eliminates the partial function dependency of the non-primary key columns on the primary key column field on the 1NF, which can greatly reduce the problems such as data insertion and deletion exceptions.
For example, there is an elective relationship table: study number, course number, score, credit, and primary key is the composite primary key: Study number and course number. But since the non-primary key column credits depend only on the course number, the composite
Primary keys are only partially dependent, not fully dependent, and therefore result in data redundancy,
The solution is to divide it into two tables: Student table: School Number, course number, score the second table is the curriculum, the course number, the credit


The third paradigm eliminates the transfer function dependency of non-primary key columns on primary key columns
Any non-primary key columns are not dependent on other non-primary key columns, that is, any non-primary key columns must not be passed on primary key columns on the basis of satisfying 2NF
(That is, there is no such case, key field (decision) non-critical field 1, non-critical field 1-> (decision) non-critical field 2
That is, for all non-keyword fields, a non-key field does not exist to determine another non-key field.
The purpose is also to store redundant information sparingly.

In simple terms, it is:
First paradigm: Having atomicity
Second paradigm: Primary key columns and non-primary key columns follow full function dependencies
Third paradigm: There is no transitive function dependency between non-primary key columns

Bath-cod paradigm (BCNF)
Boyce-codd Normal Form (Bath-cod paradigm)
On a 1NF basis, any non-primary attribute cannot be dependent on the primary key subset [eliminating the dependency on a subset of the main code on a 3NF basis]


Inverse normalization:
But in fact not necessarily need to meet 2NF, because storage space savings and the efficiency of reading speed is a contradiction, like if you often need two large table of connections,
For example, from a table user_id connect the user table to get user_name, so the light in order to read a username must connect the two tables once,
Can cause slower read speeds, consider saving the username in that table, which does not satisfy 2NF, but speeds up the reading of the data.

Database three paradigms

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.