Relational Calculcus Flashcards
SELECT
σ (select condition) R
Unary operation
Applies to rows
Commutative
PROJECT
π (attribute list) R
Unary operation
Applies to columns
Removes duplicate tuples
RENAME
ρ (new attribute names) (R)
Applies to tables and columns
UNION
R ∪ S
Result is all tuples that are either in R, in S or in both.
Duplicate tuples are eliminated.
INTERSECTION
R ∩ S
Result is rows that are in R and in S
SET DIFFERENCE
R - S
Result is rows that are in R, but not in S
Not commutative
CROSS JOIN (also called Cartesian Product)
R x S
Combines every tuple from one set with every tuple from another (Total number of tuples should be # in R * # in S)
JOIN
R ⋈ S
Combines two related tuples into one big tuple
θ JOIN
θ = any conditional operator
Excludes NULL or any result where θ isn’t true
EQUIJOIN
Uses = operator
NATURAL JOIN
Same as EQUIJOIN if all columns share the same names
Removes duplicate column names
OUTER UNION
Allows union of two relations that are not union compatible
LEFT OUTER JOIN
Keeps every tuple on the left, but fills in matches on right where applicable. No matches are padded with NULLs
RIGHT OUTER JOIN
Keeps every tuple on the right, but fills in matches on the left where applicable. No matches are padded with NULLs
FULL OUTER JOIN
Keeps all tuples on both sides, even if they don’t match