Set Theoretic Operation (Cont.)


Product
Assume that R and S are two tables with Head(R)=A1…An and Head(S)=B1…Bm. The product of the tables R and S is a table T whose heading is Head(T)=R.A1…R.An S.B1…S.Bm. We say t is a row in T if and only if there are two rows u in R and v in S such that t is the concatenation of u with v, u∥v.

  • t is a row in T if and only if there are two rows u in R and v in S such that t(R.A1) = u(Ai) for 1≤i≤n and t(S.Bj) = v(Bj) for 1≤i≤m.

  • The product of R and S is denoted by R×S.

  • The attribute name of the form W.A is referred as qualified attribute names.

  • If an attribute name appears in only one table, we can refer to it using its unqualified name.
R×S
R.A R.B R.C S.A S.B S.C
a1 b1 c1 a1 b1 c1
a1 b1 c1 a1 b1 c2
a1 b1 c1 a1 b2 c3
a1 b1 c1 a3 b2 c3
a1 b2 c3 a1 b1 c1
a1 b2 c3 a1 b1 c2
a1 b2 c3 a1 b2 c3
a1 b2 c3 a3 b2 c3
a2 b1 c2 a1 b1 c1
a2 b1 c2 a1 b1 c2
a2 b1 c2 a1 b2 c3
a2 b1 c2 a3 b2 c3




      I feel bad for the homeless guy,    
      but I feel really bad for the homeless guy’s dog,    
      because he must be thinking    
      “Man, this is the longest walk ever.”