L.04 Flashcards

Relational Algebra (15 cards)

1
Q

What is Relational Algebra (RA)?

A

A mathematical language used to define queries over relational databases.

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

What are the fundamental operations in RA?
Name the five basic operations in Relational Algebra.

A

Selection (𝞂), Projection (π), Cartesian Product (×), Union (∪), and Difference (-).

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

What does Selection (𝞂) do?
What is the purpose of the Selection (𝞂 - sigma) operation?

A

It filters rows based on a condition, returning only those that match.

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

What does Projection (π) do?
What does the Projection (π - pi) operation do in RA?

A

It selects specific columns from a relation.

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

What does Union (∪) do?
What is the result of the Union (∪) operation?

A

It combines all unique rows from two relations with the same schema.

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

What does Intersection (∩) do?
What does the Intersection (∩) operation return?

A

It returns only the rows that exist in both relations.

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

What does Difference (-) do?
What does the Difference (-) operation return?

A

It returns rows in one relation but not in the other.

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

What is the Cartesian Product (×)?
What happens when we apply the Cartesian Product (×) operation?

A

It pairs every row from one relation with every row from another.

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

What is the purpose of the Join (⨝) operation?
How does Join (⨝) help in relational algebra?

A

It merges two relations based on a common attribute.

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

What is the Division (÷) operation?
What does the Division (÷) operation do?

A

It finds entities that relate to all instances of another set.

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

How do Aggregate Functions work in RA?
What are some common aggregate functions in RA?

A

SUM, COUNT, AVG, MIN, MAX.

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

What is a Primary Key in a relation?
What is a Primary Key in a relational model?

A

A unique attribute that identifies each record in a relation.

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

What is a Foreign Key?
What is a Foreign Key, and why is it important?

A

An attribute in one relation that references the Primary Key of another relation to maintain integrity.

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

How does mapping inheritance work in RA?
What are the three main ways to map inheritance in RA?

A

Table-per-class
Table-per-subclass
Single-Table

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

Why is Relational Algebra important for SQL?
How does RA relate to SQL queries?

A

RA provides the formal foundation for SQL query execution.

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