title: how to allow 0 in foreign keys constraint in mysql?
body: <p>Let's suppose I have a following table:</p>
  
  <pre><code>UID int (11) not null,  FOREIGN KEY (UID) REFERENCES users(ID),
  OID int (11),  FOREIGN KEY (OID) REFERENCES orders(ID),
  primary key(UID,OID)
  </code></pre>
  
  <p>Note the primary key. </p>
  
  <p>And, I wanted to allow to have one <code>NULL</code> in order ID (OID) for each user ID (UID).</p>
  
  <p>Though after setting the primary key it automatically makes my OID field <code>NOT NULL</code>.</p>
  
  <p>As a work around I'm thinking to store <code>0</code> instead to mark it as an unrelated field.</p>
  
  <p>So, now the question, is it possible to allow a foreign key constraint to accept also zeros (0) apart from the <code>references</code> of the specified field?</p>