Introduction to Database System
Comprehensive exam revision notes for BCA-104N Unit 3 (Relational Data Model, Constraints & Normalization). Includes Section A (2M), Section B (5M), and Section C (15M) questions, answers, and diagrams.
Introduction to Database System
Relational Data Model, Constraints & Normalization
Core Definitions & Key Concepts
Tuple, Attribute, Degree, and Cardinality in Relational Model
- Tuple: A single row in a relation representing an entity record.
- Attribute: A named column representing a property.
- Degree: The total number of attributes (columns) in a relation.
- Cardinality: The total number of tuples (rows) in a relation.
Entity Integrity Constraint and Referential Integrity Constraint
- Entity Integrity: No primary key attribute value can be NULL.
- Referential Integrity: A foreign key in a referencing relation must either match an existing primary key value in the referenced relation or be completely NULL.
What are Foreign Key action options (CASCADE, SET NULL, RESTRICT)
- ON DELETE CASCADE: Automatically deletes child rows when the parent row is deleted.
- ON DELETE SET NULL: Sets foreign key column in child rows to NULL when parent is deleted.
- ON DELETE RESTRICT / NO ACTION: Rejects parent deletion if child references exist.
Functional Dependency (FD) and differentiate Trivial vs Non-Trivial FD
An FD X -> Y holds on relation R if whenever two tuples have identical values for attribute set X, they must have identical values for attribute set Y.
- Trivial FD:
Y ⊆ X(e.g.,(Roll_No, Name) -> Roll_No). - Non-Trivial FD:
Yis not a subset ofX(e.g.,Roll_No -> Name).
State Armstrong's Axioms of Functional Dependency
- Reflexivity: If
Y ⊆ X, thenX -> Y. - Augmentation: If
X -> Y, thenXZ -> YZ. - Transitivity: If
X -> YandY -> Z, thenX -> Z.
What is the Attribute Closure (X+) and how is it used to find Candidate Keys
The attribute closure X+ is the set of all attributes functionally determined by X under given FDs. If X+ contains all attributes of relation R, then X is a Super Key. If no proper subset of X is a super key, X is a Candidate Key.
Identify the three types of Database Anomalies
- Insertion Anomaly: Inability to record certain facts without adding unrelated dummy data.
- Deletion Anomaly: Deletion of certain data accidentally removes other unrelated critical facts.
- Update (Modification) Anomaly: Updating data in one place leaves conflicting old copies elsewhere.
State the definitions of First, Second, and Third Normal Forms (1NF, 2NF, 3NF)
- 1NF: Every attribute contains only atomic (indivisible) values; no repeating groups.
- 2NF: Relation is in 1NF and contains no Partial Dependencies (every non-prime attribute is fully functionally dependent on the entire candidate key).
- 3NF: Relation is in 2NF and contains no Transitive Dependencies (no non-prime attribute depends on another non-prime attribute: for every
X -> Y,Xis a super key orYis a prime attribute).
Conceptual & Architectural Analysis
Given relation R(A, B, C, D, E) with FDs: F = { A -> BC, CD -> E, B -> D, E -> A }. Compute closures and find all Candidate Keys of R
1. Compute Attribute Closures
A+:- Start:
{A} - Apply
A -> BC:{A, B, C} - Apply
B -> D:{A, B, C, D} - Apply
CD -> E:{A, B, C, D, E}
Since A+ = {A, B, C, D, E}, `A` is a Candidate Key.
E+:- Start:
{E} - Apply
E -> A:{E, A} - Since
A+includes all attributes,E+ = {A, B, C, D, E}. `E` is a Candidate Key. (CD)+:- Start:
{C, D} - Apply
CD -> E:{C, D, E} - Apply
E -> A:{A, C, D, E} - Apply
A -> BC:{A, B, C, D, E}. `CD` is a Candidate Key. (BC)+:- Start:
{B, C} - Apply
B -> D:{B, C, D} - Since
(CD)+derives all attributes,(BC)+ = {A, B, C, D, E}. `BC` is a Candidate Key.
2. Candidate Keys of R
The Candidate Keys are: `A`, `E`, `BC`, and `CD`.
Partial Functional Dependency and illustrate 2NF decomposition with a concrete example
1. Partial Dependency Defined
A partial dependency occurs when a non-prime attribute is dependent on only a part of a composite candidate key, violating 2NF.
2. Example
Consider relation STUDENT_COURSE_SCORE:
- Schema:
(Student_ID, Course_ID, Student_Name, Marks) - Primary Key:
(Student_ID, Course_ID) - FDs:
(Student_ID, Course_ID) -> Marks(Full dependency on compound key)Student_ID -> Student_Name(Partial Dependency:Student_Namedepends only onStudent_ID).
3. Decomposition into 2NF
Decompose into two relations eliminating partial dependency:
STUDENT( Student_ID, Student_Name )COURSE_SCORE( *Student_ID, Course_ID*, Marks )
In-Depth Analysis & Implementation
Database Normalization in complete detail. Walk through an unnormalized table and decompose it systematically through 1NF, 2NF, and 3NF, explaining the elimination of anomalies at each stage
1. Purpose of Normalization
Normalization is the systematic process of organizing relational database tables to minimize data redundancy and eliminate insertion, update, and deletion anomalies while preserving functional dependencies and lossless joins.
2. Unnormalized Table (UNF)
Consider an employee project assignment sheet:
EMP_PROJ(Emp_ID, Emp_Name, Dept_ID, Dept_Name, {Project_ID, Project_Name, Hours})
Here, projects are repeating multi-valued groups for each employee.
3. Step 1: Conversion to 1NF (Atomicity)
- Rule: Eliminate repeating groups and multivalued attributes so every cell holds an atomic value.
- 1NF Schema:
EMP_PROJ_1NF(Emp_ID, Emp_Name, Dept_ID, Dept_Name, Project_ID, Project_Name, Hours) - Candidate Key:
(Emp_ID, Project_ID) - Identified FDs:
(Emp_ID, Project_ID) -> Hours(Full Key dependency)Emp_ID -> Emp_Name, Dept_ID, Dept_Name(Partial dependency onEmp_ID)Project_ID -> Project_Name(Partial dependency onProject_ID)Dept_ID -> Dept_Name(Transitive dependency viaDept_ID)- Anomalies in 1NF: We cannot add an employee with no project (Insertion Anomaly); deleting a project deletes the employee (Deletion Anomaly).
4. Step 2: Conversion to 2NF (Elimination of Partial Dependencies)
- Rule: Every non-prime attribute must depend on the whole candidate key.
- Decomposition:
PROJECT( Project_ID, Project_Name )EMP_DEPT( Emp_ID, EmpName, DeptID, Dept_Name )EMP_ASSIGNMENT( *Emp_ID, Project_ID*, Hours )
Now, all three tables are in 2NF.
5. Step 3: Conversion to 3NF (Elimination of Transitive Dependencies)
- In table
EMP_DEPT:
Emp_ID -> Dept_ID and Dept_ID -> Dept_Name.
Therefore, Emp_ID -> Dept_Name is a Transitive Dependency (non-key attribute depends on non-key attribute).
- Rule: For every non-trivial FD
X -> Y,Xmust be a super key orYmust be a prime attribute. - Decomposition of `EMP_DEPT`:
DEPARTMENT( Dept_ID, Dept_Name )EMPLOYEE( Emp_ID, EmpName, *DeptID* )
6. Final Normalized 3NF Database Schema
EMPLOYEE( Emp_ID, EmpName, *DeptID* )DEPARTMENT( Dept_ID, Dept_Name )PROJECT( Project_ID, Project_Name )EMP_ASSIGNMENT( *Emp_ID, Project_ID*, Hours )
All redundancy and anomalies are completely eliminated.
Important Exam Points & Quick Revision
In BCA-104N Unit 3, candidate key determination using attribute closures and a full walkthrough of 1NF -> 2NF -> 3NF decomposition with table examples are the most heavily weighted topics in university exams. Always write the mathematical definitions of 1NF, 2NF, and 3NF before working through an example.
100% left on this page — finishing it closes the gap for Relational Data Model, Constraints & Normalization.
Relational Data Model, Constraints & Normalization still counts as a weak topic until you finish this note and answer its questions.
Practise this unitTest Your Understanding
Now that you've read through these notes, practice unit MCQs to identify weak points and solidify your learning before exams.