Question :

What is 2NF? How is it achieved.

Subject

Database Management System

Standard

Computer Science Engineering

Views

687

Asked By

Angelina

Qayanat
Answer / Solution

The second step in Normalization is 2NF. A table is in 2NF, only if a relation is in 1NF and meet all the rules, and every non-key attribute is fully dependent on primary key. The Second Normal Form eliminates partial dependencies on primary keys.

A relation is said to be in the 2nd Normal Form in DBMS (or 2NF) when it is in the First Normal Form but has no non-prime attribute functionally dependent on any candidate key's proper subset in a relation. A relation's non-prime attribute refers to that attribute that isn't a part of a relation's candidate key.

Let's assume, a school can store the data of teachers and the subjects they teach. In a school, a teacher can teach more than one subject. In the given table, non-prime attribute TEACHER_AGE is dependent on TEACHER_ID which is a proper subset of a candidate key. That's why it violates the rule for 2NF.

Below are a few of the advantages of using the second normal form.

  • Redundant data is reduced more effectively.
  • Data is consistent in the database.
  • It improves the flexibility in designing a Database.
  • It also improves the overall organization of data in the database.
  • It also improves the security of the database.
Angelina
Answer / Solution

Second Normal Form (2NF) is a level of database normalization that aims to eliminate redundant data in a database table. It is based on the concept of functional dependencies, which refers to the relationship between attributes in a table.

To satisfy 2NF, a table must first satisfy 1NF, which requires that the table be free of repeating groups and have a primary key defined. Additionally, every non-key attribute in the table must be functionally dependent on the entire primary key.

A relation that is in First Normal Form and every non-primary-key attribute is fully functionally dependent on the primary key, then the relation is in Second Normal Form (2NF).

In other words, a table is in 2NF if it meets the following two requirements:

  • It is in First Normal Form (1NF).
  • All non-key attributes (i.e., attributes that are not part of the primary key) are fully functionally dependent on the entire primary key.

If a table has attributes that are dependent on only part of the primary key, those attributes are moved to a separate table with a foreign key relationship to the original table.

By eliminating partial dependencies in this way, we can avoid redundancy and ensure that each piece of data is stored in only one place, making the database more efficient and less prone to errors.

By satisfying 2NF, we can ensure that the data in our database is organized in a way that minimizes redundancy, which can lead to data inconsistencies and other issues.

To explain 2NF with an example, consider a table called "Orders" with the following columns:

  • Order ID (primary key)
  • Customer ID (primary key)
  • Customer Name
  • Product ID
  • Product Name
  • Product Description
  • Quantity
  • Order Date

This table is not in 2NF because the non-key attributes "Customer Name," "Product Name," and "Product Description" are not fully dependent on the primary key. Instead, they are partially dependent on the "Customer ID" and "Product ID" columns.

To normalize this table to 2NF, we need to split it into two tables: "Orders" and "Products."

The "Orders" table will have the following columns:

  • Order ID (primary key)
  • Customer ID (primary key)
  • Quantity
  • Order Date

The "Products" table will have the following columns:

  • Product ID (primary key)
  • Product Name
  • Product Description

By doing this, we have eliminated data redundancy and ensured that each table contains data that is relevant and fully dependent on the primary key.
 

Anaisha
Answer / Solution

Second Normal Form (2NF) is a level of database normalization that aims to eliminate redundant data in a database table. It is based on the concept of functional dependencies, which refers to the relationship between attributes in a table.

Let's assume, a school can store the data of teachers and the subjects they teach. In a school, a teacher can teach more than one subject.

TEACHER table

Teacher ID Subject Age
25 Chemistry 30
15 Biology 35
16 Physics 30
25 Computer 35
12 Computer 35

In the given table, non-prime attribute TEACHER_AGE is dependent on TEACHER_ID which is a proper subset of a candidate key. That's why it violates the rule for 2NF. To convert the given table into 2NF, we decompose it into two tables:

TEACHER_DETAIL table:

 

Teacher ID  Age
25 30
15 35
16 30

TEACHER_SUBJECT table:

Teacher ID Subject 
25 Chemistry
15 Biology
16 Physics
25 Computer
12 Computer

Top Trending Questions


Recent Question Update

Explain Domain Key Normal Form DKNF with example.
Explain Project Join Normal Form PJNF with example.
Explain 4nf and 5nf with example.
What is 5nf in DBMS.
What do you mean by 4NF in DBMS. Explain with example.
What is BCNF Boyce Codd Normal Form. Explain it.
What is normalization? Explain 3NF with example.
What is 1NF? How do we achieve it.
What are the different normal forms in DBMS?
Brief Introduction to the Normalization.
Explain multivalued dependencies
What do you mean by lossless join? How can we test it.
What is the meaning of decomposition in DBMS? List its properties.
Explain the closure of attribute sets.
What do you mean by closure of a set of functional dependencies.
Explain the inference rules for functional dependencies in DBMS
What is the Difference between BCNF and 4NF in DBMS.
SQL Full Outer Join Using Left and Right Outer Join and Union Clause
Difference between Natural join and Inner Join in SQL
Define aggregate function in database.
Write the operations which are responsible for database modification.
Explain natural join operation.
Differentiate union, intersection and set difference operations.
Explain fundamental operations of relational algebra with example.
What do you mean by database scheme. Explain with example.
What do you mean by relational algebra?
Explain Aggregation
What do you mean by Generalization and Specialization in DBMS?
Explain superclass and subclass entity types
Describe EER Model?
What is ER Entity relationship Diagram.
Explain the concept of weak entity and strong entity.
What are the entities and attributes? Explain them.
What are keys? Discuss its types.
Define relationship sets.
What do you mean by attributes? Explain its types.
What are the limitations of a database system.
Explain database administrator and its functions
Explain different database system users
What is database abstraction. Explain its levels.
Write advantages and disadvantages of Hierarchical Data Model
Write advantages and disadvantages of Network Data Model
Write advantages and disadvantages of Relational Data Model
What are data models? Explain its types.
Write different applications of a database
What are the advantages and disadvantages of a database system
Explain Database. Explain different types of elements.

Advantages Of NCERT, CBSE & State Boards Solutions For All Subjects

  • All the NCERT Solutions have been prepared by academic experts having 10+ years of teaching experience.
  • They have prepared all the solutions in simple and easy language so that each and every student can understand the concepts easily.
  • All the solutions have been explained step to step-wise in details with better explanations.
  • Students can also use these question and answers for your assignments and in homework help.
  • All the solutions have been explained in detail and the answers have been compiled in a step-wise manner.
  • All the questions and answers are commonly prepared according to the Latest Syllabus of Board Education and Guidelines.
  • Students can know about the various types of questions asked in the exams with the help of these solutions.

Top Course Categories