题目: complete set 表示 R⨝S, R⟗S
Inner join和Outer join ⨝ ⟕ ⟖ ⟗
如何用 complete set 中的 operators 表示出來 complete set中五個operators為
• selection σ
• projection ∏
• Cartesian product ×
• union ⋃
• set difference −
令R (x,y) , S (y,z) ,则R⨝S 求解如下:
(1): Inner join: R⨝S
W = R×S
H = σ R.y=S.y (W)
R⨝S= ∏R.x,R.y,S.z (H)
令R (x,y) , S (y,z) ,则R⟗S 求解如下:
R⟗S 求解如下:
(2): Outer join: R⟗S
W = R×S
H = σ R.y=S.y (W)
U1 = ∏R.x,R.y,S.z (H)
L1 = ∏R.x,R.y(H)
L2 = R−L1
U2 = L2×(∏ S.z (σL2.y=S.y(S)))
R1 = ∏S.y,S.z(H)
R2 = S − R1
U3= R2×(∏ R.x (σR2.y=R.y(R)))
R⟗S = U1⋃U2⋃U3
- R⟗S 解题, 如下图所示::