The following is a comprehensive set of algebraic operations that comprise an Extended Relational Algebra. They are atomic, in the sense that they each carry out precisely one operation and can be combined as needed. There is some redundancy, by design.
Each operation is a function with one or two relation values as arguments and returns one as its result. Each operation is generic, and has to be specialised for each use. It is specialised by:
- The heading of each of its relation arguments
- One or more attribute names, where the operation involves adding, removing or substituting attributes.
- A function name and appropriate arguments, as attribute names or literal values, where the operation requires a computation.
Each operation returns a value with a heading determined entirely by the specialisation as set out above. The ERA depends on a library of pre-defined functions that are compatible with the types of the various attributes. The library and those types are specified separately. The ERA has type system, and no means to access tuple or attribute values.
The ERA also includes an assignment operation, which updates the value of a pseudo-variable, identified by a literal value.
|select<args,bfn>(r)||Arguments to Boolean function||Restricts set membership|
|remove<name>(r)||An attribute to remove||Removes an attributes|
|rename<name1,name2>(r)||An attribute and its new name||Renames one attribute|
|extend<args,fn,name>(r)||Arguments to function, name for new value||Appends one attribute|
|replace<args,fn,name>(r)||Arguments to function, name of replaced value||Replaces the value of one attribute|
|join(r1,r2)||Auto for join||Natural join|
|semijoin(r1,r2)||Auto for join||Natural semijoin|
|antijoin(r1,r2)||Auto for join||Natural antijoin|
|compose(r1,r2)||Auto for join||Join removing join attributes|
|aggregate<names,arg,afn>(r)||Grouping attributes, argument to aggregating function||Replace one attribute by grouped aggregation|
|while<rfn>(r)||Relational function||Fixed point recursion|
|var<lit>||Literal name of pseudo-variable||Reference to a stored value|
insert<lit>(r) delete<lit,args,bfn>(r) replace<lit,args,fn,name>(r)
|Literal name of pseudo-variable Arguments to Boolean function Arguments to function, name of replaced value||Update a stored value|