title: How to link these two tables in sql
body: <p>I'v kind of login system where user add each other but when both users add each other we want to show them in different format/color.
  For example:A user is logged In and want to add others.
  If the currently logged in user adds someone into the system who has also added this currently logged In user then we want to show both of them in different format.</p>
  
  <p><strong>Will become clear from the following scenario.</strong></p>
  
  <p>I'v two table one is <code>user</code> <a href="https://i.stack.imgur.com/DEEaH.png" rel="nofollow noreferrer">user</a>, and the second is <code>userdata</code> <a href="https://i.stack.imgur.com/qviRN.png" rel="nofollow noreferrer">userdata</a>.
  Column <code>id</code>  is primary key in <code>user</code> and Foreign key in <code>userdata</code> as <code>adder</code>.
  I want to insert the data into the table called <code>user</code> when the structure is something like this.</p>
  
  <p><code>user</code></p>
  
  <pre><code> id       name
  
   1        Alice
   2        Bob
   3        jhon
  </code></pre>
  
  <p><code>userdata</code></p>
  
  <pre><code> adder    added
    1        2
    1        3
  </code></pre>
  
  <p>the <code>userdata</code> table shows that the user <strong>Alice has added Bob</strong> and <strong>Alice added jhon</strong> so whenever there is already a relation in <code>userdata</code> like</p>
  
  <pre><code>  1        2     i.e (**Alice added Bob**)
  </code></pre>
  
  <p>and when there is second row populated from front end that says</p>
  
  <pre><code>  2        1 i.e (**Bob added Alice**)
  </code></pre>
  
  <p>so when this happens i.e Alice added Bob and vice versa I want to  insert them in to the DB and show them in different way.How to take decision when Alice Added Bob and Bob Added Alice.</p>