next up previous
Next: Querying database using Relational Up: RELATIONAL MODEL OF DATA Previous: Relational Rules

Relational Algebra

     R           S           R union S    R - S   
     A  B  C     D  E  F     A  B  C      A  B  C 
     -------     -------     -------      -------
     a  b  c     b  g  a     a  b  c      a  b  c 
     d  a  f     d  a  f     d  a  f      c  b  d
     c  b  d                 c  b  d
                             b  g  a

     R intersection S     R x S
     A  B  C              A  B  C  D  E  F
     -------              ----------------
     d  a  f              a  b  c  b  g  a
                          a  b  c  d  a  f 
                          d  a  f  b  g  a
                          d  a  f  d  a  f
                          c  b  d  b  g  a
                          c  b  d  d  a  f

     R             S         T        select[B="b"](R)
     A  B  C  D    C  D  E   C  D     A  B  C  D 
     ----------    -------   ----     ---------- 
     a  b  c  d    c  d  e   c  d     a  b  c  d  
     a  b  e  f    c  d  f   e  f     a  b  e  f 
     b  c  e  f    d  e  f            a  b  d  e   
     e  d  c  d
     e  d  e  f
     a  b  d  e

     project[A,B](R)   R join S           R div T
     A  B              A  B  C  D  E      A  B
     ----              -------------      ----
     a  b              a  b  c  d  e      a  b
     b  c              a  b  c  d  f      e  d
     e  d              e  d  c  d  e
                       e  d  c  d  f
                       a  b  d  e  f



Raj Sunderraman
Tue Apr 1 16:15:10 PST 1997