title: SQL Comparing two attributes as 1 combination
body: <p>I am student, new to database programming and new to Stack Overflow!</p>
  
  <p>Basically I have a database which has:</p>
  
  <p>Table => Attributes</p>
  
  <pre><code>Mine =&gt; MineID, Name, NumberOfWorkers
  Ore =&gt; OreID, Name, ChemicalFormula                 
  OreProduction =&gt; OreProdID, Mine, Ore, AmountPerYear
  Contract = &gt; ContractID, Ore, Mine, Smelter, AmountOfOre
  </code></pre>
  
  <p>There are other tables but I think these are those relevant to my problem.</p>
  
  <p>Now my Question is :</p>
  
  <p>"Which mines have the capacity to mine an ore that they have not yet contracted to a smelter, and
  what Ore(s) are they?"</p>
  
  <p>Now this gives me all the mines that can mine an ore AND have it is contracted to a smelter</p>
  
  <pre><code>SELECT DISTINCT Mine.Name, Ore.Name
  FROM OreProduction
  INNER JOIN Mine
  ON Mine.MineID = OreProduction.Mine
  INNER JOIN Ore
  ON Ore.OreID = OreProduction.Ore
  INNER JOIN ContractDetail
  ON OreProduction.Mine = ContractDetail.Mine
  AND OreProduction.Ore = ContractDetail.Ore
  </code></pre>
  
  <p>How can I get the inverse for this ? 
  I've tried to use this as a sub query but how can I tell SQL that Mine and Ore together NOT IN the above sub query ?</p>
  
  <p>I hope you've understood what I'm trying to say and thanks in advance for your replies</p>