Normalization Flashcards

1
Q

What is normalization in relational schemas?

A

A process to eliminate redundancies and anomalies by decomposing schemas into smaller, well-structured relations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Main types of anomalies in relational schemas

A
  1. Redundancy
  2. Update Anomaly
  3. Deleyion anomaly
  4. Insertion anomaly
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Functional dependency (FD)

A

Constraint where one attribute uniquely determines another

EmployeeID —> Salary

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Candidate Key

A

Minimal set of attributes that uniquely identifies a tuple (row) in a relation (table)

EMPLOYEE(EmployeeID, Name, Department)

EmployeeID is a candidate key because it uniquely identifies employees.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Transitive Dependency

A

Non-prime attribute depends on another non-prime attribute indirectly through a candiate key

EmployeeID depends on Department, Department depends on manager, manager is transitively dependent on EmployeeID

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

1NF

A

A relation is in 1NF is all attributes contain atomic values (No nested or multivalued attributes)

NO: City: Boston, Cambridge

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

2NF

A

A relation is in 2NF if it is in 1NF and has no non-prime attribute partially dependent on a candidate key

Remove partial dependencies from attributes

If we have StudentID, StudentName, CourseID, CourseName, and Grade:

Remove:
StudentName and CourseName

2NF:
StudentID, CourseID and Grade because

  • StudentName is non-prime
  • CourseName is non-prime

And they are both depend partially on the composite key (one of the keys in the composite key group)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

3NF

A

A relation is in 3NF if it is in 2NF and has no transitive dependency of non-prime attributes on any candidate key

Remove transitive dependencies from attributes

EmployeeID, Name, DepartmentID, DepartmentName

DepartmentName depends on EmployeeID indirectly

Solution

Remove DepartName

EmployeeID, Name DepartmentID

this is why we only see what is absolutely necessary to identify

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How do you normalize a relation with multivalued attributes (1NF violation)

A

Split multivalued attribute into a separate relation (table) with a foreign key referencing the original relation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How do you resolve partial dependencies (2NF violation)

A

Move attributes that depend only on part of a composite key into a separate relation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How do you handle transitive dependencies (3NF violation)

A

Move attributes with transitive dependencies into separate relations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Normalize EMPLOYEES(EmployeeID, Name, Salary, Department)

A
  • EMP_SALARY(EmployeeID, Salary)
  • EMP_DEPARTMENT(EmployeeID, Department)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Normalize BOOKS relation with FDs:
(Title → Author, Genre and Title, Copy → Shelf)

A

Split into:
* BOOKS(Title, Author, Genre)
* COPIES(Title, Copy, Shelf)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Lossless Decomposition

A

Original table can be reconstructed by joining the smaller tables w/out loss of data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is FD preservation in decomposition?

A

Ensuring all functional dependencies in the original schema are maintained in the decomposed schema

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is a trivial FD?

A

An FD where the right-hand side is a subset of the left-hand side

EmployeeID, Name –> Name

17
Q

HOw do decomposition algorithms work?

A

Create relations for each FD group with the same determinant and ensure lossless joins and FD preservation