First Normal Form (1NF)
First Normal Form (1NF)
Introduction
In the realm of database design, normalization plays a crucial role in ensuring data consistency, eliminating redundancy, and enhancing efficiency. The process of normalization begins with the First Normal Form (1NF), which lays the foundation for organizing data into structured, reliable, and atomic units.
This blog post explores the concept of 1NF in a professional and comprehensive manner. We’ll discuss what qualifies a relation to be in 1NF, review examples of unnormalized data, learn methods to convert them into 1NF, and finally, understand the anomalies that can still exist even after achieving this form.
Machine Learning Tutorial:-Click Here
Data Science Tutorial:-Click Here
Complete Advance AI topics:-Â CLICK HERE
Deep Learning Tutorial:-Â Click Here
What is First Normal Form (1NF)?
A relation is said to be in First Normal Form (1NF) if all the attributes in the table contain only atomic (indivisible) values. This means that each field must hold a single value, not a set or list of values.
1NF disallows:
- Multi-valued attributes
- Composite attributes
- Combinations of the above
Let’s look at an example to illustrate this.
Example: EMPLOYEE Table (Unnormalized)
EMP_ID | EMP_NAME | EMP_PHONE | EMP_STATE |
---|---|---|---|
14 | John | 7272826385, 9064738238 | UP |
20 | Harry | 8574783832 | Bihar |
12 | Sam | 7390372389, 8589830302 | Punjab |
The EMP_PHONE
attribute holds multiple values in a single field. This is a clear violation of 1NF as the data is non-atomic. Such relations are referred to as unnormalized relations.
Converting to 1NF
To bring this relation into First Normal Form, we must eliminate the multi-valued attribute by breaking it into individual rows.
Normalized EMPLOYEE Table (1NF)
EMP_ID | EMP_NAME | EMP_PHONE | EMP_STATE |
---|---|---|---|
14 | John | 7272826385 | UP |
14 | John | 9064738238 | UP |
20 | Harry | 8574783832 | Bihar |
12 | Sam | 7390372389 | Punjab |
12 | Sam | 8589830302 | Punjab |
Now, every field contains atomic values, and the table satisfies the rules of 1NF.
Methods to Achieve First Normal Form
Method 1: Flattening the Relation
This approach involves repeating the non-repeating attributes (like EMP_ID, EMP_NAME) for each value in the multi-valued attribute. As shown in the above normalized EMPLOYEE table, this is a straightforward and intuitive method.
Method 2: Decomposition into Separate Tables
Another method is to decompose the unnormalized table into multiple related tables.
EMP_DETAILS Table
EMP_ID | EMP_NAME |
---|---|
14 | John |
20 | Harry |
12 | Sam |
EMP_CONTACT Table
EMP_ID | EMP_PHONE | EMP_STATE |
---|---|---|
14 | 7272826385 | UP |
14 | 9064738238 | UP |
20 | 8574783832 | Bihar |
12 | 7390372389 | Punjab |
12 | 8589830302 | Punjab |
This decomposition keeps distinct types of data in separate relations, making the structure cleaner and more efficient. In EMP_DETAILS, EMP_ID serves as the primary key, while in EMP_CONTACT, uniqueness is guaranteed by the composite key (EMP_ID, EMP_PHONE).
Method 3: Fixed Number of Columns
Sometimes, designers attempt to keep multi-valued data in fixed columns. Consider the following example:
EMP_SKILL Table (Unnormalized)
EMP_ID | Skill |
---|---|
14 | DBMS, C, C++ |
20 | JAVA, C |
12 | DBMS, HTML, VB, MS OFFICE |
To convert this into 1NF, you might create multiple skill columns:
EMP_SKILL Table (1NF)
EMP_ID | Skill_1 | Skill_2 | Skill_3 | Skill_4 | Skill_5 |
---|---|---|---|---|---|
14 | DBMS | C | C++ | – | – |
20 | JAVA | C | – | – | – |
12 | DBMS | HTML | VB | MS OFFICE | – |
While this method formally satisfies 1NF, it is not scalable or efficient. It restricts the number of possible skills and makes querying more complex. For example, finding employees who possess the skill “C” becomes non-trivial.
Why Not Stop at 1NF?
Although 1NF eliminates the immediate problem of multi-valued attributes, it does not resolve all data redundancy and integrity issues. Certain anomalies may still persist.
Anomalies in First Normal Form
Let’s explore three types of anomalies using the ORDER_BOOK
relation:
Order_No | B_Name | Quantity | Price |
---|---|---|---|
4253 | C | 15 | 175 |
4253 | Database | 20 | 225 |
4154 | IT | 30 | 200 |
4256 | C | 50 | 175 |
4186 | Database | 15 | 225 |
1. Insertion Anomaly
If we want to insert a new book into this relation without an associated order, we cannot do so. Since Order_No
and B_Name
form the composite primary key, both values are required. But the book has not been ordered yet, so Order_No
is unknown. This violates the entity integrity rule.
2. Deletion Anomaly
Suppose order number 4154 is canceled. Deleting that row would also remove all information about the book “IT”, as it’s the only record containing it. This results in unintended data loss.
3. Updation Anomaly
If the price of book “C” changes, we must update all rows that refer to it. Failure to update every instance risks inconsistent data and violates data integrity.
Complete Python Course with Advance topics:-Click Here
SQL Tutorial :-Click Here
Download New Real Time Projects :-Click here
Conclusion
First Normal Form is the initial and essential step in structuring a relational database. It ensures that all data is atomic and removes multi-valued attributes, reducing redundancy and improving integrity. While multiple methods exist to achieve 1NF, decomposing tables into smaller, logically grouped relations is often the most effective and scalable approach.
However, reaching 1NF is not the end of normalization. Data anomalies such as insertion, deletion, and updation issues may still exist. To resolve these, the next step is to advance toward Second Normal Form (2NF), which focuses on eliminating redundancy caused by partial dependencies.
Stay tuned with Updategadh as we continue exploring database normalization in our upcoming posts.
second normal form
1st, 2nd and 3rd normal form examples
2nf in dbms
third normal form
first normal form example
1nf, 2nf, 3nf
first normal form in dbms
what is the first normal form 1nf in database normalization
first normal form 1nf example
first normal form 1nf in dbms
first normal form 1nf pdf
Post Comment