Do you think IIT Guwahati certified course can help you in your career?
No
1 NF in DBMS is a part of normalization. Normalization is used to remove the redundancy and inconsistent dependence in the database. Anomalies in insertion, deletion, and update can be caused by relation redundancy.
To normalize a dataset, we break down this large dataset into different smaller datasets depending upon the relationships among tables.
There are various types of normal forms. Some of them are
Here, we will be discussing the first normal form.
What is First Normal Form?
A relation (table) in a DBMS is in First Normal Form (1NF) if all its attributes contain atomic values (single, indivisible data) and there are no repeating groups within the table. Additionally, each attribute must have a unique name.
Rules of 1st NF in DBMS
For a table to be in 1NF, it should follow these rules:
The table only contains composite or single-valued attributes.
Every Attribute/Column should have a different name.
There should be no difference in which order data is stored.
The domain of the attribute should not change.
Example of 1NF in DBMS
Because of the multi-valued attribute STUD_PHONE, the relation STUDENT is not in 1NF
Example 1
STUDENT table:
STUD_ID
STUD_NAME
STUD_PHONE
STUD_CITY
1
Harsh
727282638X,
906473823X
Delhi
2
Shivam
981161425X
Banglore
3
Pranav
739037238X,
858983030X
Mumbai
The above table decomposed into 1NF will like this:
STUD_ID
STUD_NAME
STUD_PHONE
STUD_CITY
1
Harsh
727282638X
Delhi
1
Harsh
906473823X
Delhi
2
Shivam
981161425X
Banglore
3
Pranav
739037238X
Mumbai
3
Pranav
858983030X
Mumbai
Example 2
Here's an example of a table violating 1NF:
Customer ID
Customer Name
Courses Enrolled
1
Alice
Math, Science, English
2
Bob
Programming, History
drive_spreadsheetExport to Sheets
This table violates 1NF because of the "Courses Enrolled" column. It contains multiple values (course names) separated by commas, which breaks the rule of atomic values in a cell.
Fixing the Table for 1NF
Here's how to fix the table to comply with 1NF:
Create a Separate Table for Courses:
We'll create a new table named "Enrollments" to link customers with their enrolled courses.
Enrollments Table:
Enrollment ID (Primary Key)
Customer ID (Foreign Key)
Course Name
1
1
Math
2
1
Science
3
1
English
4
2
Programming
5
2
History
Original Customer Table (Modified):
Customer ID (Primary Key)
Customer Name
1
Alice
2
Bob
Frequently Asked Questions
What are the anomalies in 1NF in DBMS?
1NF itself doesn't have anomalies (data inconsistencies). However, tables that violate 1NF principles can lead to insertion, deletion, and update anomalies during data manipulation.
Why is 1NF important?
1NF is the foundation for a well-structured database. It ensures data integrity by eliminating redundancy and promoting efficient data manipulation, retrieval, and modification.
What is the significance of 1NF in database design?
1NF serves as the first step in database normalization. By enforcing atomic values and eliminating repeating groups, it creates a solid base for further normalization processes that optimize database design for efficiency and accuracy.
How do you convert data to the first normal form?
Identify and eliminate repeating groups within a table. If data needs to be repeated for certain rows, create separate tables and link them with appropriate relationships. Additionally, ensure each cell contains a single, indivisible value.
Does 1NF have a primary key?
1NF doesn't mandate a primary key. However, establishing a primary key for each table is good practice and often implemented during database normalization processes beyond 1NF.
Conclusion
We learned about the First Normal Form (1NF) in DBMS in this article. First Normal Form (1NF) serves as the essential building block for a well-organized and efficient database. By enforcing atomic values and eliminating repeating groups, 1NF promotes data integrity and simplifies data manipulation.
Since SQL-related questions are frequently asked in interviews, we recommend you practice Top 100 SQL problems on Code360.