Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2003
    Posts
    5

    Unhappy Complete set of R.A. operators

    I've got an assignment, and am stuck.

    Is {π, U, , ·} a complete set of relational algebra operators? If not, which of the relational algebra operations can't be difined using this set.

    Hope someone have time to help....

  2. #2
    Join Date
    Oct 2002
    Location
    Baghdad, Iraq
    Posts
    697

    Re: Complete set of R.A. operators

    Originally posted by seethetipi
    I've got an assignment, and am stuck.

    Is {π, U, , ·} a complete set of relational algebra operators? If not, which of the relational algebra operations can't be difined using this set.

    Hope someone have time to help....
    First: spell 'em out. I see project, set union, a blank and a multiplication dot, which I've never seen used as a relational operator. (Well, I used it once, but I'm hardly an authority.)

    I'll assume that you're not looking to define any extended relational operations such as grouping or outer joins. I'll further assume you've never read Date and Darwen's material, so you aren't allowing relation-valued attributes.

    The best way to decide whether or not you have a full set of operations is to come up with some example queries you want to perform and figure out how to do them with what you've got.

  3. #3
    Join Date
    Oct 2003
    Posts
    5
    thank you, your tip was actually very good

    (it was supposed to be project, union, minus and join)

  4. #4
    Join Date
    Oct 2002
    Location
    Baghdad, Iraq
    Posts
    697
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •