Relational Algebra Operators in Database Management
This article summarizes the symbols and operations of relational algebra as explained in a video from the CMU Database Group, a YouTube channel by Carnegie Mellon University.
Basic Relational Algebra Operators
- σ (Selection)
-
Symbol: σ (Sigma)
Description: The Selection operator is used to filter rows based on a specified condition.
Example: σcondition(relation) - π (Projection)
-
Symbol: π (Pi)
Description: The Projection operator selects specific columns from a table.
Example: π(column1, column2, ...)(relation) - ∪ (Union)
-
Symbol: ∪ (Union)
Description: The Union operator combines the results of two tables, removing duplicates.
Example: relation1 ∪ relation2 - ∩ (Intersection)
-
Symbol: ∩ (Intersection)
Description: The Intersection operator returns only the rows that are present in both tables.
Example: relation1 ∩ relation2 - − (Difference)
-
Symbol: − (Minus or Difference)
Description: The Difference operator returns the rows present in the first table but not in the second.
Example: relation1 − relation2 - × (Cartesian Product)
-
Symbol: × (Cross or Cartesian Product)
Description: The Cartesian Product operator returns the Cartesian product of two tables.
Example: relation1 × relation2 - ⨝ (Join)
-
Symbol: ⨝ (Join)
Description: The Join operator combines rows from two tables based on a related column.
Example: relation1 ⨝ relation2
Additional Relational Algebra Operators
- ρ (Rename)
-
Symbol: ρ (Rho)
Description: The Rename operator is used to rename the relation or attributes.
Example: ρnew_name(relation) - ← (Assignment)
-
Symbol: R ← S (Assignment)
Description: The Assignment operator assigns the result of a query to a relation variable.
Example: R ← σcondition(relation) - δ (Duplicate Elimination)
-
Symbol: δ (Delta)
Description: The Duplicate Elimination operator removes duplicate rows from a relation.
Example: δ(relation) - γ (Aggregation)
-
Symbol: γ (Gamma)
Description: The Aggregation operator is used for aggregate functions such as SUM, COUNT, AVG, etc.
Example: γ(attribute, SUM(attribute))(relation) - τ (Sorting)
-
Symbol: τ (Tau)
Description: The Sorting operator sorts the relation by specified attributes.
Example: τ(attribute)(relation) - ÷ (Division)
-
Symbol: ÷ (Division)
Description: The Division operator finds tuples in one relation that are related to all tuples in another relation.
Example: relation1 ÷ relation2
Sources
"F2023 #01 - Relational Model & Algebra (CMU Intro to Database Systems)" by CMU Database Group:
Addendum
I'm currently reading "E. F. Codd and Relational Theory (revised edition)" by C. J. Date, which introduces additional operators without specific symbols.