title: How can I implement a boolean tag search in SQL?
body: <p>Given a table of items, a table of tags and a join table between them, what is a good and efficient way to implement queries of the form:</p>
  
  <p><code>p1 AND p2 AND ... AND pn AND NOT n1 AND NOT n2 ... AND NOT nk</code></p>
  
  <p>I am using SQL. So to find all items that match all tags p1...pn and none of n1...nk? </p>
  
  <p>Is there a good "standard" solution for this?</p>