title: sql - Is it possible to add foreign key to table which references to id colum on the same table
body: <p>I have user account system which needs sub-account system. So there is the "main account" and accounts that can acces the main account data. I was thinking of users table where is field "subaccount" true or false. And then according to "parent-account" field open data from account id that the "parent-account" references to.</p>
  
  <p>How do you feel about this?</p>
  
  <pre><code>SELECT * FROM users WHERE id = :id
  if("SUBACCOUNT" exists){
     SELECT * FROM users WHERE id= :parentaccount
     echo parentaccounddata
     $_session['parentaccount'] = false; //restrict certain features
  }
  </code></pre>