L.04 Flashcards
Relational Algebra (15 cards)
What is Relational Algebra (RA)?
A mathematical language used to define queries over relational databases.
What are the fundamental operations in RA?
Name the five basic operations in Relational Algebra.
Selection (𝞂), Projection (π), Cartesian Product (×), Union (∪), and Difference (-).
What does Selection (𝞂) do?
What is the purpose of the Selection (𝞂 - sigma) operation?
It filters rows based on a condition, returning only those that match.
What does Projection (π) do?
What does the Projection (π - pi) operation do in RA?
It selects specific columns from a relation.
What does Union (∪) do?
What is the result of the Union (∪) operation?
It combines all unique rows from two relations with the same schema.
What does Intersection (∩) do?
What does the Intersection (∩) operation return?
It returns only the rows that exist in both relations.
What does Difference (-) do?
What does the Difference (-) operation return?
It returns rows in one relation but not in the other.
What is the Cartesian Product (×)?
What happens when we apply the Cartesian Product (×) operation?
It pairs every row from one relation with every row from another.
What is the purpose of the Join (⨝) operation?
How does Join (⨝) help in relational algebra?
It merges two relations based on a common attribute.
What is the Division (÷) operation?
What does the Division (÷) operation do?
It finds entities that relate to all instances of another set.
How do Aggregate Functions work in RA?
What are some common aggregate functions in RA?
SUM, COUNT, AVG, MIN, MAX.
What is a Primary Key in a relation?
What is a Primary Key in a relational model?
A unique attribute that identifies each record in a relation.
What is a Foreign Key?
What is a Foreign Key, and why is it important?
An attribute in one relation that references the Primary Key of another relation to maintain integrity.
How does mapping inheritance work in RA?
What are the three main ways to map inheritance in RA?
Table-per-class
Table-per-subclass
Single-Table
Why is Relational Algebra important for SQL?
How does RA relate to SQL queries?
RA provides the formal foundation for SQL query execution.