course content

Course Content

Relational Database and Normalization

Unnormalized Form. First Normal FormUnnormalized Form. First Normal Form

Unnormalized form

The normal forms are the rules for optimizing the database's view and structure. A database that doesn't follow these rules is called an unnormalized database, which may have redundancy, inconsistency, and other data-related issues.

Note

An Unnormalized Form is a form of database that violate any of the normal forms.

Let's look at an example:

There is the table Customer with columns Customer and Phone Number, but that looks not cool. Let's normalize it!

First Normal Form

The First Normal Form rules:

  • Every table should have a unique primary key - the minimum set of columns that identifies a record. (ID is usually used).
  • Each attribute must have only one value, not multiple values.

On the unnormalized form example, you can see the two entities: Customer and Phone Number have no unique keys and can raise problems with identic customer names. Also, you can see that the attribute Phone Number has multiple values.

Let's bring the database to the first normal form:

Cool! Now we have two tables! We've create a new table "Phone Number" and relation "Customer ID" in that table.

Also, the First Normal Form means that every table should have a unique key (primary key). There are primary keys Customer ID in the table Customer and unique phone numbers in the table Phone Number.

Note

The Customer ID column in the table Phone Number should have a foreign key.

If you want to use Phone Number via the Customer table, you can use JOIN operations.

The First Normal Form allows the ability to sort and order data through queries: If you have many phone numbers in one cell, sorting and organizing them can become much more difficult. To do this, it will be necessary to extract phone numbers from each cell, divide them and compile a new data set.

Summary. First Normal Form


AdvantagesDisadvantages
Access to data by IDTakes up more memory
Ability to repeat data such as Name, Surname, etc
Ability to write simple queries
Faster data sets retrieval
Improves the structure of the database

question-icon

What mean the First Normal Form?

Select a few correct answers

Section 3.

Chapter 2