Re: Dreaming About Redesigning SQL

From: Paul G. Brown <paul_geoffrey_brown_at_yahoo.com>
Date: 8 Oct 2003 15:07:59 -0700
Message-ID: <57da7b56.0310081407.71d1bc8e_at_posting.google.com>


mikharakiri_at_yahoo.com (Mikito Harakiri) wrote in message news:<bdf69bdf.0310080845.4d71a1f0_at_posting.google.com>...
> paul_geoffrey_brown_at_yahoo.com (Paul G. Brown) wrote in message news:<57da7b56.0310080006.47b550a9_at_posting.google.com>...
> > RELATION Dept ( Id Dept_Id KEY, Name String );
> > RELATION Emp ( Id Emp_Id KEY, Dept REF(Dept),
> > Name PersonName, Salary Money );
> >
> > RETRIEVE E.Name, DEREF(E.Dept).Name FROM Emp E;
> >
> > RETRIEVE E.Name FROM Emp E, Dept D
> > WHERE DEREF(E.Dept).Id = E.Id AND D.Name = 'shoe';
>
> I'm not sure I understand what DEREF(E.Dept).Id = E.Id predicate is
> saying. Are you matching Employee id against Department id? Therefore,
> if ref/deref is indeed just a syntactic sugar around foreign key
> constraint, what is the syntax for join predicate?

  Oh. My bad:

  RETRIEVE E.Name FROM Emp E, Dept D

     WHERE DEREF(E.Dept).Id = D.Id AND D.Name = 'shoe';
                             ^^^
                               \_ Dodgy alias in original.
Received on Thu Oct 09 2003 - 00:07:59 CEST

Original text of this message