title: Using SQL to find the total number of customers with over X orders
body: <p>I've been roasting my brain with my limited SQL knowledge while attempting to come up with a query to run a statistic on my orders database.</p>
  
  <p>Table ORDERS is laid out like this:</p>
  
  <pre><code>CustomerID ProductID (etc)
  1              10
  1              10
  1              11
  2              10
  4              9
  </code></pre>
  
  <p>Each purchase is recorded with the customer id and the product ID - there CAN be multiple records for the same customer, and even multiple records with the same customer and product.</p>
  
  <p>I need to come up with a query that can return the amount of customers who bought between X and X distinct products - for example, 3 customers bought less then 5 different products, 10 bought from 5-10 different products, 1 bought over 10 different products. </p>
  
  <p>I'm pretty sure this has something to do with derived tables, but advanced SQL is a new fairly craft to me. Any help would be appreciated!</p>