1-NF form in DBMS
About 1-NF Form in DBMS
In this article, we will learn about 1-NF Form in DBMS.
Normalization is a process of breaking a table into you still optimized ones so that they are free from all problems faced due to insertion updation and deletion of data in the table
First Normal Form(1NF)
- Definition: A table is said to be in First Normal Form if it is free from
multivalued or composite attributes
i.e each attribute should be atomic - A multivalued attribute is nothing but it contains more than one value in a single cell
Problem Table:
Consider a table where a student can have multiple phone numbers
STUDENT
Roll no | Name | Phone |
---|---|---|
66 | Trishaank | P1 |
73 | Prashant | P2,P3 |
79 | Sanjay | P4 |
82 | Srinivas | P5 |
Approach 1:
Eliminate the multivalued attribute by introducing a composite keyi.e roll number, phone number combination would act as a primary key
Problem Table
Roll no | Name | Phone |
---|---|---|
66 | Trishaank | P1 |
73 | Prashant | P2,P3 |
79 | Sanjay | P4 |
82 | Srinivas | P5 |
Normalized to 1NF
Roll no | Name | Phone |
---|---|---|
66 | Trishaank | P1 |
73 | Prashant | P2 |
73 | Prashant | P3 |
79 | Sanjay | P4 |
82 | Srinivas | P5 |
Drawback:
This approach causes serious drawback of update anomaly due to redundancy in the table (Prashant data stored redundantly)
Approach 2:
Divide the table into two parts such that all the multivalued attributes in one table at single-valued attributes in another table and add primary key attribute of the original table to each newly formed tables
Student Phone
Roll no | Phone |
---|---|
66 | P1 |
73 | P2 |
73 | P3 |
79 | P4 |
82 | P5 |
Student
Roll no | Name |
---|---|
66 | Trishaank |
73 | Prashant |
79 | Sanjay |
82 | Srinivas |
In this example, multivalued attributes phone numbers and primary key attribute roll number will from one table and all the remaining single-valued attributes name and primary key attribute roll number will from another table
Approach 3:
Make each and every attribute as atomic i.e introduce n separate columns for n multivalues
Problem Table
Roll no | Name | Phone |
---|---|---|
66 | Trishaank | P1 |
73 | Prashant | P2,P3 |
79 | Sanjay | P4 |
82 | Srinivas | P5 |
Normalized to 1NF
Roll no | Name | Phone1 | Phone2 | Phone3 |
---|---|---|---|---|
66 | Trishaank | P1 | ——– | ——– |
73 | Prashant | P2 | P3 | ——– |
79 | Sanjay | P4 | ——– | ——– |
82 | Srinivas | P5 | ——– | ——– |
Drawbacks:
It’s it not necessary that each and every student would have multiple phone numbers, as a result, empty cells have to be maintained which results in memory wastage
Prime Course Trailer
Related Banners
Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription
Get over 200+ course One Subscription
Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others
Login/Signup to comment