Relational Algebra Flashcards
1
Q
Projection
A
- Extracts attributes from a relation
- pi_{attributes}(relation)
2
Q
Selection
A
- Selects tuples from a relation that match a predicate
- sigma_{predicate}(relation)
3
Q
Cartesian Product
A
- Forms a new relation containing all possible combinations of tuples from R_{1} with tuples from R_{2}
- R_{1} x R_{2}
4
Q
Natural Join
A
- Performs a filtered Cartesian product, removing tuples in which attributes with the same name have different values, and keeping only one copy of each duplicated column
- R_{1} |x| R_{2}
5
Q
Condition (Theta) Join
A
- Performs a filtered Cartesian product according to a specified predicate
- R_{1} |x|{Theta} R{2}
6
Q
Left Outer Join
A
- In addition to the natural-join tuples, include an extra tuple for each tuple from R_{1} with no match in R_{2}
- In the extra tuples, assign the R_{2} attributes NULL
- R_{1} -|x| R_{2}
7
Q
Right Outer Join
A
- In addition to the natural-join tuples, include an extra tuple for each tuple from R_{2} with no match in R_{1}
- In the extra tuples, assign the R_{1} attributes NULL
- R_{1} |x|- R_{2}
8
Q
Full Outer Join
A
- In addition to the natural-join tuples, include an extra tuple for each tuple from R_{2} with no match in R_{1}
- In the extra tuples, assign the R_{1} attributes NULL
- R_{1} -|x|- R_{2}
9
Q
Set Difference
A
- Select tuples that are in one relation but not the other
- The relations must have the same number of attributes
- Corresponding attributes must have the same domain
- R_{1} - R_{2}
10
Q
Assignment
A
- Assigns the result of an operation to a temporary variable or an existing relation
- Relation <– expression