title: Relational Algebra formula for a SQL command
body: <p>I have the following SQL command:</p>
  
  <pre><code>SELECT X,Y,Z FROM A,B,C WHERE A.U=B.U AND A.V=C.V
  ORDER BY X,Y
  </code></pre>
  
  <p>I need to write the relational algebra formula for this query. So far I'm at:</p>
  
  <pre><code>E =  (π{X,Y,Z}(S{X,Y} ( σ {A.B.U AND A.V=C.V} (A))) * 
       (π{X,Y,Z}(S{X,Y} ( σ {A.B.U AND A.V=C.V} (B))) * 
       (π{X,Y,Z}(S{X,Y} ( σ {A.B.U AND A.V=C.V} (C)))
  </code></pre>
  
  <p>Is this correct ? I am not sure if i have between A, B, C a union or a cartesian product ?</p>
  
  <p>Also I need to transform this expression in an optimal expression. Can anybody give me a step by step example on how to do that?</p>
  
  <p>Thanks !</p>