title: SQL joining three tables, join precedence
body: <p>I have three tables: R, S and P.</p>
  
  <p>Table R Joins with S through a foreign key; there <em>should</em> be at least one record in S, so I can JOIN:</p>
  
  <pre><code>SELECT
          *
      FROM 
          R
      JOIN    S ON (S.id = R.fks)
  </code></pre>
  
  <p>If there's no record in S then I get no rows, that's fine.</p>
  
  <p>Then table S joins with P, where records is P may or may not be present and joined with S.</p>
  
  <p>So I do</p>
  
  <pre><code>SELECT
          *
      FROM 
          R
      JOIN    S ON (S.id = R.fks)
      LEFT JOIN P ON (P.id = S.fkp)
  </code></pre>
  
  <p>What if I wanted the second JOIN to be tied to S not to R, like if I could use parentheses:</p>
  
  <pre><code>SELECT
          *
      FROM 
          R
      JOIN    (S ON (S.id = R.fks) JOIN P ON (P.id = S.fkp))
  </code></pre>
  
  <p><em>Or is that already a natural behaviour of the cartesian product between R, S and P?</em></p>