0% found this document useful (0 votes)
8 views

Advanced Database Concepts3 BCNF Notes

Advanced database on concepts 3b
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Advanced Database Concepts3 BCNF Notes

Advanced database on concepts 3b
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Boyce-Codd Normal Form (BCNF)

 Definition: A relation is in BCNF if and only if every determinant is a candidate key.

 Key differences from 3NF:

 3NF allows functional dependencies where the non-key attribute is not a candidate key.

 BCNF requires that the non-key attribute be a candidate key.

 Example: Consider a relation with attributes EmployeeID, Name, Department, and Manager.
If Manager is a candidate key, then the relation is in BCNF.

CANDIDATE KEY

A candidate key in a database is a set of one or more fields or columns that can uniquely identify a
record in a relational database. It is a type of unique key that ensures data integrity and consistency by
preventing duplicate entries. Each table in a database can have multiple candidate keys, but only one
can be chosen as the primary key.

Key Characteristics

1. Uniqueness: A candidate key ensures that each record in a table can be uniquely identified by its
values.

2. Minimal: A candidate key is minimal, meaning it does not contain any redundant attributes.

3. No NULL Values: A candidate key cannot contain NULL values.

4. Functional Dependency: The candidate key has a functional dependency on all other attributes
in the table

Importance

1. Data Integrity: Candidate keys ensure data integrity by preventing duplicate entries and
ensuring each record can be uniquely identified.

2. Relationship Establishment: Candidate keys are used to establish relationships between tables.

3. Query Optimization: Candidate keys play a vital role in indexing and optimizing queries.

4. Database Normalization: Candidate keys are closely associated with database normalization,
which helps eliminate data redundancy and anomalies

Example

Consider a student database with attributes StudentID, Name, RollNo, Email, and MobileNo. Each of
these attributes can uniquely identify a student, making them candidate keys. However, only one can be
chosen as the primary key
Fourth Normal Form (4NF)

 Definition: A relation is in 4NF if and only if it does not contain any multi-valued dependencies.

 Multi-valued dependencies: A multi-valued dependency exists when a non-key attribute


depends on a combination of key attributes.

 Example: Consider a relation with attributes OrderID, ProductID, Quantity, and Price.
If Price depends on both OrderID and ProductID, then the relation is not in 4NF.

 Example: Consider a relation with attributes StudentID, Course, and Hobby. If StudentID
determines both Course and Hobby, then the relation is not in 4NF.

This table is in 4NF because it has no multi-valued dependencies. However, it has overlapping
dependencies between the CustomerID and OrderID attributes. This means that the same set
of CustomerID and OrderID values can determine different sets
of ProductName and ProductDescription values, which can lead to data anomalies and redundancies. To
normalize this table to 5NF, we need to split it into three tables:
Fifth Normal Form (5NF)

 Definition: A relation is in 5NF if and only if it does not contain any join dependencies.

 Join dependencies: A join dependency exists when a non-key attribute depends on the join of
two or more key attributes.

 Example: Consider a relation with attributes OrderID, ProductID, Quantity, and Price.
If Price depends on both OrderID and ProductID, then the relation is not in 5NF.

In this normalized schema, the Customer, Order, and Product tables contain only information about the
customers, orders, and products, respectively. The Order_Product table contains only the relationship
between orders and products, with foreign keys to the Order and Product tables. This ensures that there
are no join dependencies between the attributes in the schema.
In this normalized schema, the Student table contains only information about the students,
the Hobby table contains only information about the hobbies, and the Mobile_Hobby table contains the
relationship between students and their hobbies. This ensures that there are no join dependencies
between the attributes in the schema.
WHAT ARE THE KEY DIFFERENCES BETWEEN BCNF, 4NF, AND 5NF

The key differences between Boyce-Codd Normal Form (BCNF), Fourth Normal Form (4NF), and Fifth
Normal Form (5NF) are:

Boyce-Codd Normal Form (BCNF)

 A relation is in BCNF if and only if every determinant is a candidate key.

 BCNF is less strict than 4NF.

 A relation in BCNF may have multi-valued dependencies.

 A relation in BCNF may or may not be in 4NF.

Fourth Normal Form (4NF)

 A relation is in 4NF if and only if it is in BCNF and has no multi-valued dependencies.

 A relation in 4NF is always in BCNF.

 4NF is more strict than BCNF.

 A relation in 4NF will have less redundancy compared to BCNF.

Fifth Normal Form (5NF)

 A relation is in 5NF if and only if it is in 4NF and has no join dependencies.

 A relation in 5NF will have the least redundancy compared to BCNF and 4NF.

 A relation in 5NF cannot be decomposed further without modifying the meaning or facts.

 5NF is also known as Project-Join Normal Form (PJNF).

You might also like