L8 Normal Forms Flashcards

1
Q

What is Data redundancy?

A

Data redundancy is a condition created within a database or data storage technology in which the same piece of data is held in two separate places.

This can mean two different fields within a single database, or two different spots in multiple software environments or platforms.

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

What is lossy decomposition?

A

The decompositio of relation R into R1 and R2 is lossy when the join of R1 and R2 does not yield the same relation as in R.

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

What is good database design based on?

A

on using certain normal
forms
for relation schemas

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

What is Transitive dependency?

A

Transitive dependency occurs when

a non-key attribute is determining another non-key attribute

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

What is the First Normal Form (1NF)?

A

For a table to be in the First Normal Form, it should follow the following rules:

  • It should only have single(atomic) valued attributes/columns.
  • Values stored in a column should be of the same domain
  • All the columns in a table should have unique names.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Name two interconnected problems caused by bad database design.

A
  • Redundancy problems
  • Update anomalies
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a Trivial Functional Dependency?

A

If a functional dependency (FD) X → Y holds, where Y is a subset of X, then it is called a trivial FD. Trivial FDs always hold.

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

What are the three types of update anomalies?

A
  1. Insertion Anomalies
  2. Deletion Anomalies
  3. Modification Anomalies
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is Dependency Preservation?

A

A decomposition is dependency preserving if the FDs
which hold on the original relation schema can be tested
on the decomposed schemas, without using joins.

“Putting it simply dependency is preserved when we find both sides of the FD in the attributes of one sub-schema”

We cannot always find a BCNF decomposition that is
dependency preserving.
To test that no FDs are violated, we may need to join
relations (expensive).
We can always find a 3NF dependency-preserving
decomposition.

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

What is an insertion anomaly?

A

An insertion anomaly is the inability to add data to the database due to absence of other data.

For example, assume Student_Group is defined so that null values are not allowed. If a new employee is hired but not immediately assigned to a Student_Group then this employee could not be entered into the database. This results in database inconsistencies due to omission.

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

What is a Lossless join?

A

the ability to ensure that any instance of the original relation can be identified from corresponding instances in the smaller relations

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

What is the Boyce–Codd normal form (BCNF)?

A

A relational schema R is in Boyce–Codd normal form if and only if for every one of its dependencies X → Y, at least one of the following conditions hold:

1) X → Y is a trivial functional dependency (Y ⊆ X)
2) X is a superkey for schema R

It is a slightly stronger version of the third normal form (3NF)

BCNF acts differently from 3NF only when there are multiple overlapping candidate keys.

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

What is the Third normal form (3NF)?

A
  • The relation R (table) is in second normal form (2NF)
  • Every non-prime attribute of R is non-transitively dependent on every key of R.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is Dependency Preservation?

A

A decomposition is dependency preserving if the FDs
which hold on the original relation schema can be tested
on the decomposed schemas, without using joins.

We cannot always find a BCNF decomposition that is
dependency preserving.

We can always find a 3NF dependency-preserving
decomposition.

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

Describe the BCNF Decomposition Algorithm.

A

Split R into two relation schemas:
1. R1 , containing all the attributes in the
violating FD
2. R2 containing all attributes in R
except those on the RHS of the violating FD

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

What is a modification anomaly?

A

a data inconsistency that results from data redundancy and a partial update.

For example, each employee in a company has a department associated with them as well as the student group they participate in. If A. Bruchs’ department is an error it must be updated at least 2 times or there will be inconsistent data in the database. If the user performing the update does not realize the data is stored redundantly the update will not be done properly.

17
Q

What is Partial dependency?

A

Partial dependency means that a nonprime attribute is functionally dependent on part of a candidate key.

18
Q

What is Normalization?

A

Normalization is the process of splitting relations into well structured relations that allow users to insert, delete, and update tuples without introducing database inconsistencies.

Without normalization many problems can occur when trying to load an integrated conceptual model into the DBMS.

19
Q

Describe the 3NF Decomposition Algorithm.

A

Given a relation schema R and a set of FDs F, the following steps produce a 3NF decomposition of R that
satisfies the lossless join condition and is dependency preserving:
1. Eliminate redundant FDs (we haven’t covered this).
2. Create a relation Ri = XY for each FD X → Y in F
3. If the key K of R does not occur in any relation Ri, create one more relation Ri=K
4. Delete any of the relations Ri that are contained in another.

20
Q

What are update unomalies?

A

problems which are the results from the un-normalized databases

21
Q

What is a deletion anomaly?

A

the unintended loss of data due to deletion of other data

For example, if the student group Beta Alpha Psi disbanded and was deleted from the table above, J. Longfellow and the Accounting department would cease to exist. This results in database inconsistencies and is an example of how combining information that does not really belong together into one table can cause problems.

22
Q

What is the Second Normal Form? (2NF)

A

a relation is in 2NF if it is in 1NF and every non-prime attribute of the relation is dependent on the whole of every candidate key

A functional dependency on part of any candidate key is a violation of 2NF. In addition to the primary key, the relation may contain other candidate keys; it is necessary to establish that no non-prime attributes have part-key dependencies on any of these candidate keys.

23
Q

Which Normal Form can guarantee dependency preservation?

A

3NF

24
Q

Compare Boyce-Codd Normal Form and Third Normal Form in terms of their relative advantages and disadvantages.

A
  • a table in BCNF is already in 3NF, but BCNF is stronger
  • we cannot always find a BCNF decomposition that is dependency preserving
    • to test that no FDs are violated, we may need to join relations (expensive)
  • we can always find a 3NF decomposition that is dependency preserving
25
Q

Why does 3NF disallow relation schemas which have transitive FD’s?

A
  • trasitive: non prime attribute determines another non prime attribute
  • this can lead to inconsistencies / update anomalies?
    • lets say A -> B and B -> C
    • if B is not a prime attribute, we can allow null values for B
    • but if we have null values for B, then we can’t find some Cs