title: Is there a way to find out if my data is connected by a foreign key constraint or not in MySQL?
body: <p>I have a table <code>barcodes</code> that has 1000's of rows of <code>barcode</code> in it. Most of the barcodes are attached to another table (there are many different tables it can be connected to) via a foreign key constraint, so if I ran the following query, it would error out because of the constraint:</p>
  
  <pre><code>delete from barcodes
  </code></pre>
  
  <p>But somehow (by some design flaw I created within my database) there are barcodes in the table that aren't connected by any constraint, and are just free floating.</p>
  
  <p>Is there some easy query to pull back only the barcodes that aren't connected by a constraint? Something like this pseudocode:</p>
  
  <pre><code>select * from barcodes where constraint = null
  </code></pre>