1NF – What is 1NF example?
A relation is in 1NF(What is 1nf example) or first normal form if every tuple has exactly one value for each attribute.
In other words, we can say that every column should have a unique or atomic value related to the corresponding attribute.|What is 1nf example|
Within this blog(First Normal Form), we are going to explore What is 1nf example? What are 1nf 2nf and 3nf? Why is this table not in 1nf? How do you write 1nf?…
… 1NF example, 3NF example, BCNF vs 3NF, BCNF example, Step by step normalization example The need for normalization in DBMS|What is 1nf example|
A database is in its first normal form if every relation includes in a database is in 1NF(What is 1nf example).
The first normal form deals only with the basic structure of the relationship and does not resolve the problems of redundant information and any other anomalies|What is 1nf example|
Let’s understand this with the help of an example of an organization where we have information about employee_id, employee_name, phone number, and their salary|What is 1nf example|
Table 1. Non-Domain Form
Here we can see that an employee can have more than one phone number so, each tuple of the above table does not have only one value for each attribute.
For converting it into a 1NF(First Normal Form) we use the following steps-
- For each repeating field, the value creates a new tuple.
- Insert the repeating field value in that field of the new tuple
- duplicate the values of all other attributes of the original tuple and put them in a new tuple.
In our example, we have a phone_no field of Ashish and Piyush that have repeating values.
So we have to create new tuples only for these two employees. See the changes in the below table.
Table 1.1 Normalized Form
Problems and anomalies in 1NF(first normal form):
We can not insert the information of an employee who does not have a phone no.
If we delete a whole first tuple of a particular employee then we delete not only the phone no of an employee but also lose other information such as salary and employee_id.
For example: if we delete a tuple of employee Priya whose phone is disconnected then we also lose other information about Priya such as her salary.
In this form of the relation 1NF, we have the same information repeated many times.
If we want to update some information, first we have to search for all the tuples containing that information and then update all the tuples.
for example: if the salary of Piyush gets incremented to 25000 and we want this information in our relation, for this first of all we have to search all the tuples having employee name ‘Piyush’ and then update the salary to 25000 of each tuple.
But if we forget the update of any of the tuples named Piyush then it will result in inconsistency. to avoid this we go for 2NF.
Check out some amazing blog posts related to Normalization:
What is Normalization and why is it needed?
You can also go through a few more amazing blog links related to DBMS below:
Composite key: Composite key vs Super key…
What is the null value Problem in DBMS…
What is the super key in DBMS…
What is a candidate key in DBMS…
What is Key in DBMS…
BCNF – Boyce Codd Normal Form…
3NF – Third normal form…
2NF – Second Normal Form…
What is1NF(First Normal Form)…
What is normalization with an example…
What do you mean by distributed DBMS and what are its types…
What is DBMS ARCHITECTURE…
DBMS vs RDBMS: What is the main difference between DBMS and RDBMS…
What are the functions of DBA in DBMS…
Integrity constraints in DBMS…
What is a 1NF example?
Let’s assume, you have an employee table and in that employee table you have a field emp_mobile_number.
In today’s time easily there could be a case when one employee is having two mobile numbers or would be using two mobile numbers.
But here we talk about one specific employee say Mohan.
assume that, Mohan is using two mobile numbers and his both mobile number is inserted into the employee table mobile number field.
Now, in this scenario, we are having multivalued column values as mobile numbers or two mobile numbers for Mohan in one column.
So this table is not in 1 normal form.
If we want to make this table in 1NF then we will have to remove one mobile number of Mohan and keep only one single number in that column.
This was just for making you understand the concept of 1NF.
Overall, IF a relation is in 1NF then each column should have a unique value inside it.
What is 2NF in DBMS?
There have to be two most important conditions to be satisfied for having a relation in 2NF
The relation must be in 1NF- All the table attributes should have a unique column value.
No non-prime attributes should not be functionally dependent on the candidate key subset – all the non-prime attributes must be dependent on the primary key of the relation.
Non-prime attributes are those attributes that are not the part of table candidate key.
Why is 1NF used?
The first normal form is very important for having a relation or table with unique data.
It is easy to insert, update and delete the table data if each column has a unique value or record.
What is 3NF in DBMS?
A relation is said to be in 3NF If it satisfies the following conditions given below:
A relation must be in 2 NF.
Non-prime attributes should not have any transitive dependency-
For understanding this let’s assume we have a functional dependency set(emp_code->emp_age, employee_state, emp_country, emp_sal)
Here our candidate key would be emp_code.
Now in this relation, we see that emp_code->emp_state and emp_state->emp_country are true. Here emp_country is transitively dependent on emp_code.
So this relation would be considered in 3NF.
If you want to make it in 3NF then you would have to normalize this relation such as given below:
employee(emp_code, emp_age, emp_sal, emp_state)
Now this relation would be in 3NF.
Even after converting our data table into 1NF(First Normal Form) where we have a unique or single tuple value for a particular attribute we have redundancy and anomalies problems with us. So for removing the problems of 1NF, we have to go for 2NF. So in our next blog post, we will update you with the same|What is 1nf example|
Using this blog post(First Normal Form) we have gone through Within this blog, we are going to explore What is 1nf example? What are 1nf 2nf and 3nf? Why is this table not in 1nf? How do you write 1nf? 1NF example, 3NF example, BCNF vs 3NF, BCNF example, Step by step normalization example, The need for normalization in DBMS|What is 1nf example|
Hope! you would have liked this blog(What is 1nf example). Please feel free to let us know if you have any doubts about this post. You can also write to us at email@example.com. Have a good time!