The relational algebra is a formal query language for the relational database model. Each operator in the relational algebra accepts relation instances as input and returns one as output.

In addition to the standard set operations of union, intersection, set difference, and cross product, relational algebra contains these operators:

  • σ (sigma) The selection operator. This operator selects rows from a relation based on a test criterion. For example,σage > 18(X) returns all rows from X whose age attribute is greater than three.
  • π (pi) The projection operator. This operator selects columns from a relation. πuid,name(X) returns a relation instance whose rows consist of the uid and name fields in each row of X.
  • (HTML has no symbol for this, looks like a bowtie) the join operator. A join with join condition c between sets R and S is equivalent to σc(R × S).