title: SQL constraint to make 2 clumns not equal to each other
body: <p>I have a table that has two columns to store id from another table. Column1 gets id from ABC table and Column2 also gets id from that table but letter is called parent ID, so with this information I know who is parent of who. </p>
  
  <p>Now I want to create a constraint not to ever let both columns to get same id.
  The following did not work:</p>
  
  <pre><code>ALTER TABLE id_parent_table
  ADD CHECK (parent_id != main_id)
  </code></pre>
  
  <p>This is still allowing to insert two identical numbers.</p>