擅长:python、mysql、java
<p>你要找的是一份没有任何缺失成分的鸡尾酒清单,也就是说没有任何缺失成分。缺少的成分是那些<code>NOT IN</code>你的可用成分列表。有了这些观察结果,满足您需求的查询可以这样写:</p>
<pre><code>select c.* from Cocktails c
where not exists (select 1 from ing_in_cocktails r
where r.cocktail_id = c.id
and r.ing_id not in (3,4));
</code></pre>
<p>如果提供的配料表是3,4,那么你可以做你想要的杜松子酒和补品,如果提供的配料表中缺少3或4,那么你不能</p>