next up previous
Next: Path Expressions Up: Querying with Complex Types Previous: Querying with Complex Types

Relation-Valued Attributes

  1. Our extended SQL allows an expression evaluating to a relation to appear anywhere that a relation name may appear. The ability to use subexpressions freely makes it possible to take advantage of the structure of nested relations.
  2. The schema for a relation pdoc.

    		 create table pdoc

    (name MyString,

    author-list setof(ref(people)),

    date MyDate,

    keyword-list setof(MyString))

  3. To find all documents having a keyword ``database'',

    		 select name

    from pdoc

    where ``database'' in keyword-list

  4. To find pairs of the form ``doc-name, author-name'' for each document and each author of the document,


    from pdoc as B, as Y

  5. Aggregate functions can be applied to any relation-valued expression.

    		 select name, count(author-list)
    		 from pdoc

Osmar Zaiane
Tue Jul 7 15:03:55 PDT 1998