title: What is the best way to ensure that primary key and foreign key never intersect?
body: <p>Say I have a table with a primary key <code>a_id</code> and foreign key <code>b_id</code>.</p>
  
  <p>It is important that <code>a_id</code> and <code>b_id</code> never intersect, i.e. it should never be the case that there exists an <code>a_id = b_id</code>.</p>
  
  <p>What would be the best way to implement this?  Could I somehow do this on the database end (mySql), or should this be ensured programmatically?  If I ensure this programmatically, is it bad practice to insert a number for a primary key (rather than have the database autoincrement it)?  I assume I would just create a routine that checks the latest primary key and simply increments it (and I would also need to ensure that the range of <code>a_id</code> never intersects the range of <code>b_id</code>).  Any suggestions?</p>