title: Constraints, 3 FKs with One Null, SQL Server 2012, DB Theory Only
body: <p><em>please read my disclaimers before down-voting</em></p>
  
  <p>I have the following table.</p>
  
  <pre><code>Inventory (InventoryID (PK), LocationID (FK), ProductID (FK), BookID (FK), Quantity)
  </code></pre>
  
  <p>My current constraints enforce that either the <code>BookID</code> or <code>ProductID</code> cannot be null for a given row, and that <code>LocationID</code> cannot be null.</p>
  
  <p>I want a constraint that enforces the following: LocationID + ProductID + BookID must be unique. In other words, I do not want a book or product to show up twice at the same location.</p>
  
  <p>To be clear, for any record, <code>ProductID</code> or <code>BookID</code> can be null, but not both, and <code>LocationID</code> cannot be null.</p>
  
  <p>Disclaimers:</p>
  
  <ol>
  <li><p>This question is based entirely on personal curiosity. Results will not in any way impact a graded assignment. I am just curious</p></li>
  <li><p>Anyone answering this should be experienced enough to assume the excluded details</p></li>
  <li><p>I am only looking for a possible constraint, or similar solution. I am not looking for a rework</p></li>
  </ol>