Week 5 Flashcards

1
Q

What is Normalization?

A

Technique for producing a set of relations with desired properties

Remove redundancy

Remove potential for insertion, modification and deletion anomalies

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

What is an Insertion Anomaly?

A

An issue in relational databases when inserting data causes unnecessary redundancy or requires irrelevant information to be added

Cause: Occurs in poorly normalized tables, where adding new data (e.g., a student) forces the inclusion of unnecessary data (e.g., course or instructor details)

Impact: Leads to data redundancy, inconsistency, and maintenance difficulties

Fix: Normalize the database by separating data into related tables (e.g., Student, Course, Instructor) and using foreign keys to link them

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

What is a Modification Anomaly?

A

An issue in relational databases where updates (insert, delete, or modify) cause inconsistency or redundancy

Cause: Occurs in poorly normalized tables, where adding new data (e.g., a student) forces the inclusion of unnecessary data (e.g., course or instructor details)

Impact: Leads to data redundancy, inconsistency, and maintenance difficulties

Fix: Normalize the database by separating data into related tables (e.g., Student, Course, Instructor) and using foreign keys to link them

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

What is a Deletion Anomaly?

A

An issue in relational databases where deleting data causes unintended loss of other important data.

Cause: Occurs in poorly normalized tables, where multiple types of information are stored together, leading to unintended deletions

Impact: Important data might be lost when deleting a record (e.g., removing a student also deletes course information)

Fix: Normalize the database to separate data into related tables, ensuring deletion of one record doesn’t affect others

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

What is Functional Dependancy?

A

If A and B are attributes of relation R, if each value A is associated with exactly one value of B, B is said to be functionally dependant (FD) on A

Denoted A->B

A is the determinant

eg.

Student(studentID, studentName, DoB, postcode, city)

city is functionally dependant on postcode

postcode is the determinant

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

What is Transitive Dependancy?

A

If A->B and B->C, then C is transitive dependant on A via A->C

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

What is Partial Functional Dependancy?

A

Given A->B, if removing some attribute(s) from A, the dependancy still holds

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

What is Full Functional Dependancy?

A

If A->B and B is not functionally dependant on any subset of A

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

What is 1st Normal Form?

A

Remove repeating groups

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

What is 2nd Normal Form?

A

Remove partial dependancies

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

What is 3rd Normal Form?

A

Remove transitive dependancies

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

What is Boyce-Codd Normal Form (also called 3.5 NF)?

A

A stricter version of the 3rd Normal Form (3NF) that eliminates certain types of redundancy in relational databases.

Definition: A table is in BCNF if, for every non-trivial functional dependency, the left side (determinant) is a candidate key

Key Concept: In BCNF, no non-key attribute can determine another non-key attribute

Purpose: Prevents anomalies by ensuring that every determinant is a candidate key, reducing redundancy and improving data integrity

Example: If A → B (A determines B), and A is not a candidate key, the table is not in BCNF

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

What is Algebra?

A

In its most general form, algebra is the study of mathematical symbols and the rules for manipulating these symbols

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

What is Relational Algebra?

A

An Algebra whose operands are relations

Relation -> Relational Operator -> A new Relation

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

How does Relational Algebra help with us databases?

A

Relational algebra provides a means to query a means to query the data in a database and to modify the data

SQL incorporates relational algebra

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

What are the 3 Unary Operators?

A

Projection (π)

Selection (σ)

Rename (ρ)

17
Q

What is the Projection (π) Operator?

A

π(R)

Produce a new relation that only has only some of R’s columns (vertical rows)

Elimate duplicate tuples, if any

18
Q

What is the Selection (σ) Operator?

A

Produce a new relation that contains only those tuples (rows) of R that satisfy the condition

19
Q

What is the Rename (ρ) Operator?

A

The Rename (ρ) operator in relational algebra is used to rename the attributes or the entire relation (table) in a query

Purpose: Simplifies queries by changing the names of attributes or relations for clarity or to avoid conflicts (e.g., in joins)

20
Q

What are the 4 Set Operations?

A

Union (∪)

Intersection (∩)

Set difference (-)

Cartesian Product (x)

21
Q

What is the Union Set Operator?

A

R ∪ S - creates new tuple of all values in R and S (remove duplicates if any)

Think of union in probability

22
Q

What is the Intersection Set Operator?

A

R ∩ S - Creates new tuple with values only in both in R and S

Think of intersection in probability

23
Q

What is the Difference Set Operator?

A

R - S

Will create new tuple with values in R but not in S

Think of difference in probability

24
Q

What does Union Compatible mean?

A

Two relations (tables) in a database are union compatible if they have the same number of attributes (columns) and corresponding attributes have the same data types. This is necessary for performing a union operation, which combines the rows from both tables, removing duplicates

The Union, Intersection and Difference set operators are all Union Compatible

25
Q

What is the Cartesian Product (x)?

A

R x S

Produces a relation that is the concatenation of every tuple of Relation R with every tuple of relation S

26
Q

What are the 3 Binary Operations?

A

Join (⋈)

Outer Join (⟖, ⟕)

Division (÷)

27
Q

What is the Join (⋈) Operator?

A

A join operation performs a selection over the Cartesian product of 2 relations

R ⋈ S - Defines a relatio nthat contains all combinations of tuples from R and S that satisfy the join condition

28
Q

What is Equijoin?

A

Combines two tables based on matching values in specified columns, using the equality (=) condition. It retrieves rows where values in the joined columns are the same in both tables

Equijoin is special case of theta-join

29
Q

What is Natural Join?

A

Combines two tables by automatically matching columns with the same name and selecting rows where the values in these columns are equal. It avoids duplicate columns in the result

30
Q

What is Outer Join (⟖, ⟕) ?

A

Combines two tables and returns all rows from one table and matching rows from the other. If there’s no match, it fills with NULL values for the missing side. There are three types: Left, Right, and Full

31
Q

What is the Division Operator (÷) ?

A

the division operator returns rows from one table that match all values in another table. It’s used when you want to find records that are related to every item in a set