Docsity

Database Normalization: Improving Data Efficiency, Integrity, and Scalability, Slides of Database Management Systems (DBMS)

Partial preview of the text

Download Database Normalization: Improving Data Efficiency, Integrity, and Scalability and more Slides Database Management Systems (DBMS) in PDF only on Docsity!

Normalization

Database Normalization

  • Database normalization is the process of removing redundant

data from your tables in to improve storage efficiency, data

integrity, and scalability.

  • In the relational model, methods exist for quantifying how

efficient a database is. These classifications are called normal

forms (or NF ), and there are algorithms for converting a given

database between them.

  • Normalization generally involves splitting existing tables into

multiple ones, which must be re-joined or linked each time a

query is issued.

Normal Form

  • Edgar F. Codd originally established three

normal forms: 1NF, 2NF and 3NF. There are

now others that are generally accepted, but

3NF is widely considered to be sufficient for

most applications. Most tables when reaching

3NF are also in BCNF (Boyce-Codd Normal

Form).

Table 1

Title Author1 Author

ISBN Subject Pages Publisher

Database System Concepts

Abraham Silberschatz

Henry F. Korth

0072958863 MySQL, Computers

1168 McGraw-Hill

Operating System Concepts

Abraham Silberschatz

Henry F. Korth

0471694665 Computers 944 McGraw-Hill

First Normal Form

  • In our Table 1, we have two violations of First

Normal Form:

  • First, we have more than one author field,
  • Second, our subject field contains more than

one piece of information. With more than one

value in a single field, it would be very difficult

to search for all books on a given subject.

First Normal Table

  • Table 2

Title Author ISBN Subject Pages Publisher

Database System Concepts

Abraham Silberschatz

0072958863 MySQL 1168 McGraw-Hill

Database System Concepts

Henry F. Korth 0072958863 Computers 1168 McGraw-Hill

Operating System Concepts

Henry F. Korth 0471694665 Computers 944 McGraw-Hill

Operating System Concepts

Abraham Silberschatz

0471694665 Computers 944 McGraw-Hill

Subject_ID Subject

1 MySQL

2 Computers

Author_ID Last Name First Name

1 Silberschatz Abraham

2 Korth Henry

ISBN Title Pages Publisher

0072958863 Database System Concepts

1168 McGraw-Hill

0471694665 Operating System Concepts

944 McGraw-Hill

Subject Table

Author Table

Book Table

  • Each table has a primary key, used for joining

tables together when querying the data. A

primary key value must be unique with in the

table (no two books can have the same ISBN

number), and a primary key is also an index,

which speeds up data retrieval based on the

primary key.

  • Now to define relationships between the

tables

Second Normal Form

  • As the First Normal Form deals with redundancy of

data across a horizontal row, Second Normal Form

(or 2NF) deals with redundancy of data in vertical

columns.

  • As stated earlier, the normal forms are progressive,

so to achieve Second Normal Form, the tables must

already be in First Normal Form.

  • The Book Table will be used for the 2NF example

2NF Table

Publisher_ID Publisher Name

1 McGraw-Hill

ISBN Title Pages Publisher_ID

0072958863 Database System

Concepts

0471694665 Operating System

Concepts

Publisher Table

Book Table

Third Normal Form

  • Third normal form (3NF) requires that there

are no functional dependencies of non-key

attributes on something other than a

candidate key.

  • A table is in 3NF if all of the non-primary key

attributes are mutually independent

  • There should not be transitive dependencies

Boyce-Codd Normal Form

  • BCNF requires that the table is 3NF and only

determinants are the candidate keys