The operators

A relation is a whole table, with no variable names: columns are named by position, #1, #2, and so on. A relation is either given (an extensional table) or defined by R := E, where E uses these operators:

  • σφ(R): keep the rows satisfying a condition φ (filter)
  • πcols(R): choose or compute columns (project)
  • R × S: pair every row of R with every row of S
  • R ∪ S, R ∩ S, R ∖ S: union, intersection, difference
  • γcol : agg(R): group the other columns, then aggregate
Every Datalog feature we have met maps onto these. The rest of the section is that translation, one construct at a time.