title: SQL Select values of a column only if they are associated with all values of another subset, without using multiple queries
body: <p>I am sorry if this is a very basic question, but I have not been able to find an answer anywhere :</p>
  <p>Let's say I want to get the products that are sold at both stores a and b, with a single table that associates products and stores. In class, we have been taught this kind of solution :</p>
  <pre class="lang-sql prettyprint-override"><code>select product_id
  from product
  where store = &quot;a&quot;
  and product in (
    select product_id
    from product
    where store = &quot;b&quot;
  )
  </code></pre>
  <p>This however seems very inefficient to me, especially in a case where a very large table would be used. Is there any way to make a single request that satisfies both conditions, without nesting ?</p>
  <p>It feels like there has to be, but being very new to sql I actually have no idea, and I have found this type of thing extremely hard to look up. No matter what I search, I find answers to <em>similar</em> problems that don't answer my question.</p>