First normal form is a step in the process of normalizing a database, which aims to organize data in a structured and efficient way. For a table to be considered in first normal form, it must meet certain conditions:
Each field in the table should contain atomic values, meaning that each field should store a single value and not multiple values in a single field. This means that columns should be split up and not merged, and that each row should represent only one entity.
There must be a unique key that identifies each row in the table. This ensures that each row can be uniquely identified and prevents duplicate data.
In addition, data in tables should not be stored in a comma-separated format, as it causes a table to fail the first normal form.
Causes and Solutions of 1NF Violations:
Saving multivalued attributes in a comma-separated format causes difficulties in updating and inserting new values. Solution: use separate tuples for each value.
Using one tuple to represent two entities with the same attribute values causes confusion and duplication. Solution: add more columns to make the tuples unique.
Consequences of Non-Compliance with 1NF and How to Achieve Compliance:
Storing data in a non-atomic format leads to problems with data manipulation. Solution: Normalize by separating data into atomic values.
Lack of unique identification causes issues with data integrity. Solution: Introduce a unique key to identify each tuple.
Example 1
Example 1: Employee information table
Name | Phone | Skills | |
John Doe | johndoe@example.com | 555-1234 | Project management, Agile methodologies, Java |
Jane Doe | janedoe@example.com | 555-5678 | Python, Machine learning, SQL |
To bring this table to 1NF, the “Skills” column should be broken out into separate rows, with one row for each skill an employee has, like this:
Name | Phone | Skills | |
John Doe | johndoe@example.com | 555-1234 | Project management |
John Doe | johndoe@example.com | 555-1234 | Agile methodologies |
John Doe | johndoe@example.com | 555-1234 | Java |
Jane Doe | janedoe@example.com | 555-5678 | Python |
Jane Doe | janedoe@example.com | 555-5678 | Machine learning |
Jane Doe | janedoe@example.com | 555-5678 | SQL |
Example 2
Bookstore table
Title | Author | Genre | Publisher |
The Catcher in the Rye | J.D. Salinger | Fiction | Little, Brown and Company |
The Great Gatsby | F. Scott Fitzgerald | Fiction | Charles Scribner’s Sons, The Bodley Head |
To bring this table to 1NF, additional rows should be added for each publisher, with the same information for the “Title,” “Author,” and “Gen
Title | Author | Genre | Publisher |
The Catcher in the Rye | J.D. Salinger | Fiction | Little, Brown and Company |
The Great Gatsby | F. Scott Fitzgerald | Fiction | Charles Scribner’s Sons |
The Great Gatsby | F. Scott Fitzgerald | Fiction | The Bodley Head |
In this example, The table is not in first normal form as publisher is storing multiple values for same book. To bring this table in 1NF, we can make multiple rows for the same book with different publishers, like the above table
Example 3
Social media platform user information table
Username | Name | Phone | Groups | |
JohnDoe | John Doe | johndoe@example.com | 555-1234 | Friends, Family, Work colleagues, Football team |
To bring this table to 1NF, the “Groups” column should be broken out into separate rows, with one row for each group a user is in, like this:
Username | Name | Phone | Groups | |
JohnDoe | John Doe | johndoe@example.com | 555-1234 | Friends |
JohnDoe | John Doe | johndoe@example.com | 555-1234 | Family |
JohnDoe | John Doe | johndoe@example.com | 555-1234 | Work colleagues |
JohnDoe | John Doe | johndoe@example.com | 555-1234 | Football team |
As you can see in this example, the original table is not in first normal form as it is storing multiple values for the same user and the same attribute in a single field. By breaking them out into separate rows, each representing a single value, the table is now in First Normal Form and is more organized and efficient to handle.
Example 4
A school student information table
StudentID | Name | Age | Address | PhoneNumber |
S001 | Alex Doe | 20 | 123 Main St, Anytown USA | 555-1234, 555-5678 |
To bring this table to 1NF, additional rows should be added for each phone number, with the same information for the “StudentID,” “Name,” “Age,” and “Address” columns.
StudentID | Name | Age | Address | PhoneNumber |
S001 | Alex Doe | 20 | 123 Main St, Anytown USA | 555-1234 |
S001 | Alex Doe | 20 | 123 Main St, Anytown USA | 555-5678 |
In all these examples, the table is not in first normal form due to storing multiple values in one column, by separating them to different rows, the tables will be in 1NF and be more organized and efficient to handle.