Quote:
Originally posted by seethetipi
thank you, your tip was actually very good 
(it was supposed to be project, union, minus and join)
|
Oh, okay. I've usually seen join written as a bowtie, e.g. |X|.
Try this:
Suppose I have a relation (table) named "Student Equals Child" with attributes (columns) named "Student" and "Child" and every possible tuple (row) such that "Student" is equal to "Child". Part of it might look like this:
Student | Child
----------+--------
Bob | Bob
Mary | Mary
And so forth, with every possible name. Now, I have a database with two relations "Students" and "Parents of Children". I'm trying to find the parents of some subset of "Students", but "Parents of Children" has two attributes, "Parent" and "Child" whereas Students only has "Student."
Suppose Students looks like this:
Student | ...
-----------+------
Bob | ...
Mary | ...
So I join "Students" against "Student equals Child". Now I get:
Student | Child | ...
-----------+------+---
Bob | Bob | ...
Mary | Mary | ...
Now I can use the project operator to preserve all columns except for "Student", thus getting:
Child | ...
------+---
Bob | ...
Mary | ...
So now you can see how an infinite relation can be used along with natural join to get a rename operator.
I've actually done most of this in Scheme (a variant of LISP), and managed to get my primitives down to 4, while implementing the extended relational model, including grouping, restrict clauses, and a form of outer join through what amounts to a lot of macro expansions.