next up previous
Next: The Rename Operation Up: Basic Structure Previous: The where Clause

The from Clause

  1. The from class by itself defines a Cartesian product of the relations in the clause.
  2. SQL does not have a natural join equivalent. However, natural join can be expressed in terms of a Cartesian product, selection, and projection.
  3. For the relational algebra expression

    displaymath1738

    we can write in SQL,

     select distinct cname, borrower.loan#
    

    from borrower, loan

    where borrower.loan# = loan.loan#

  4. More selections with join: ``Find the names and loan numbers of all customers who have a loan at the SFU branch,'' we can write in SQL,

     select distinct cname, borrower.loan#
    

    from borrower, loan

    where borrower.loan# = loan.loan#

    and bname=``SFU''



Osmar Zaiane
Fri May 22 19:39:12 PDT 1998