title: SQL SELECT that excludes rows with any of a list of values?
body: <p>I have found many Questions and Answers about a SELECT excluding rows with a value "NOT IN" a sub-query (such as <a href="https://stackoverflow.com/questions/5231712/sql-not-in-not-working">this</a>). But how to <strong>exclude a list of values</strong> rather than a sub-query?</p>
  
  <p>I want to search for rows whose timestamp is within a range but exclude some specific date-times. In English, that would be:</p>
  
  <blockquote>
    <p>Select all the ORDER rows recorded between noon and 2 PM  today except for the ones of these times: Today 12:34, Today 12:55, and Today 13:05.</p>
  </blockquote>
  
  <p>SQL might be something like:</p>
  
  <pre class="lang-sql prettyprint-override"><code>SELECT * 
  FROM order_
  WHERE recorded_ &gt;= ?
  AND recorded_ &lt; ?
  AND recorded_ NOT IN ( list of date-times… )
  ;
  </code></pre>
  
  <p>So two parts to this Question:</p>
  
  <ul>
  <li>How to write the SQL to exclude rows having any of a list of values?</li>
  <li>How to set an arbitrary number of arguments to a <code>PreparedStatement</code> in JDBC?<br />(the arbitrary number being the count of the list of values to be excluded)</li>
  </ul>