title: SQL: Find the names of sailors who have reserved at least two boats
body: <h2>Question</h2>
  <p>Consider the table:</p>
  <pre><code>sailors (sid, sname, rating, age)
  boats (bid, bname, color)
  reserves (sid, bid, date)
  </code></pre>
  <p>Find the names of sailors who have reserved at least two boats.</p>
  <h2>My Approach</h2>
  <pre><code>select s.sid,count(b.bid) 
  from sailors s, reserves r
  where s.sid=r.sid 
  group by r.sid 
  having count(r.bid) &gt; = 2
  </code></pre>
  <p>I got the answer in this query.</p>
  <p>But the answer gives</p>
  <pre><code>SELECT sname
  FROM s, r r1, r r2
  WHERE s.sid=r1.sid 
    AND s.sid=r2.sid 
    AND r1.bid&lt;&gt;r2.bid 
  </code></pre>
  <p>Both are giving the same answer, but I just want to know the sequence of how it actually works; the associativity.</p>
  <p>Please help me out.</p>