Normalization Flashcards

1
Q

When designing a database, at which step do you look at normalization?

A

In the logical step as this is where you pay more attention to the attributes

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

What is normalization aiming to minimize

A

Update and deletion inefficiencies and anomalies.

Removing data redundancy

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

Data normalization is a progressive process; what are the steps?

A
  1. The steps are called normal forms.
  2. Each step increases the efficiency of the database.
  3. To be in the third normal form the database has to conform to 1st and 2nd normal form.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the overall goal of normalization?

A

To find the minimum number of attributes necessary for a relation that still satisfies the requirements.

Group logical attributes in relations (tables),

Minimize update, delete anomalies

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

what is the main purpose of normalization

A

minimize the redundancy and remove Insert, Update and Delete Anomaly.

It divides larger tables to smaller tables and links them using relationships.

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

What is insertion anomalies?

A

when data is inserted wrong, for example, more information is added to a column than there should be.

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

What is a deletion anomaly?

A

deletion anomalies occur whenever deleting a row inadvertently causes other data to be deleted

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

when does update anomalies occur?

A

when updating data has to happen in multiple rows to change one single fact

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

What is a functional dependency?

A

When an attribute (B) is dependent on another attribute (A) - then attribute A can identify B.

e.g. attribute A (student_id) -> B (student_name).
Note: if you have B then you can’t be certain about A.

In words: student_name is functional dependent on studfent_id.

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

How can you identify functional dependencies?

A

Look at which attributes can be used to uniquely identify a row.

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

What is a candidate key

A

A candidate key is an attribute that can be used as a primary key, but is not - it can uniquely identify the row.

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

What is a partial dependency?

A

A partial dependency is when you have an attribute that is functionally dependent on a candidate key

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

What are the requirements of 1st NF? (Normal form)

A
  1. Values in the columns must be atomic

2. No multi-valued or composite attributed

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

What is the 2nd Normal Form?

A

When all non-primary keys are fully dependent on the primary key.

This means that you should remove partial dependencies. (attributes dependent on a candidate attribute)

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

How can you remove partial dependencies?

A

You take the dependent attribute and the candidate key it is dependent on and moves it into a new table.

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

What is a transitive dependency?

A

When you have a relation with the attributes A, B and C.

And C is dependent on B that is dependent on A. Then C is transitively dependent on A

17
Q

What is 3NF?

A

A table is in 3rd NF when all attributes are mutually independent but at the same time are fully dependent on the primary key.

18
Q

What is the disadvantage of normalizing the database a lot?

A

The more normalized data is, the more complex the queries need to be to retrieve data.

Inner joins are often needed and they are computationally expensive

19
Q

What is denormalisation?

A

reversing normal forms to optimize the queries for example.

20
Q

When do you want a denormalised database?

A

When you need to do reads often. Its used a lot in data warehouses or reporting tables.

21
Q

Are there any other ways to denormalise other than just reversing normal forms?

A

Yes, several;
separate active and inactive data.
separate heavily and lightly accessed fields.
making pre-joined tables