What is a functional dependency (FD) in a database? Flashcards

A functional dependency 𝑋 β†’ π‘Œ Xβ†’Y exists if for any two tuples with the same values for 𝑋 X, they must have the same values for π‘Œ Y. (18 cards)

1
Q

Q: What is a functional dependency (FD) in a database?

A

A functional dependency
𝑋
β†’
π‘Œ
X→Y exists if for any two tuples with the same values for
𝑋
X, they must have the same values for
π‘Œ
Y.

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

: Give an example of a functional dependency.

A

In a table with StudentID, StudentName, CourseID, and CourseName, StudentID β†’ StudentName means StudentID determines StudentName.

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

Q: What is the first normal form (1NF)?

A

A: 1NF ensures that the domain of each attribute contains only atomic (indivisible) values and that each value in a column is of the same data type.

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

What is the second normal form (2NF)?

A

2NF ensures that a table is in 1NF and that all non-key attributes are fully dependent on the primary key, eliminating partial dependencies.

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

What is the third normal form (3NF)?

A

3NF ensures that a table is in 2NF and that all attributes are only dependent on the primary key, eliminating transitive dependencies.

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

What is the Boyce-Codd Normal Form (BCNF)?

A

BCNF is a stricter version of 3NF where every determinant must be a candidate key, ensuring no anomalies remain.

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

What is an insertion anomaly?

A

An insertion anomaly occurs when you cannot insert data due to missing related data, or you have to insert incomplete data due to table structure.

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

: Why are functional dependencies important in normalization?

A

A: FDs help identify redundancy and anomalies, guiding the decomposition of tables to achieve higher normal forms.

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

Give an example of an insertion anomaly.

A

In a table with StudentID, StudentName, CourseID, and CourseName, you might not be able to add a new student until they enroll in a course.

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

: What is a deletion anomaly?

A

A deletion anomaly occurs when deleting a record results in the unintended loss of additional data that should have been retained.

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

Give an example of a deletion anomaly.

A

Deleting a student’s enrollment in a course might also remove all information about the student if it is stored in the same table.

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

What is a modification anomaly?

A

A modification anomaly occurs when changing data in one place requires multiple updates or leads to inconsistent data.

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

Give an example of a modification anomaly.

A

Changing a student’s address in a table where it is stored redundantly may require multiple updates, leading to potential inconsistencies.

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

What is denormalization in a database?

A

Denormalization is the process of intentionally introducing redundancy into a database to improve read performance.

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

: What are the benefits of denormalization?

A

Denormalization can improve read performance, simplify queries, and optimize performance in read-heavy systems.

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

What are the trade-offs of denormalization?

A

Denormalization increases redundancy, storage costs, and complexity in data maintenance, which can lead to data inconsistencies.

17
Q

When is denormalization particularly useful?

A

Denormalization is useful in data warehousing, reporting systems, and read-heavy applications where read performance is critical.

18
Q

Give an example of denormalized data structure.

A

Combining student and course enrollment information into a single table to avoid joins and improve read performance.