title: Best practice for storing tree data in a database
body: <p>I think the classic form of the problem is you have employees and employees have managers so the manager has a manager unless he's the CEO.</p>
  
  <p>So how do you store the data?  Solution 1: It would seem that the employee table can have manager_id or you can have an employee_manager table (that way you can have many or zero managers).</p>
  
  <p>Some people say solution 1 is a bad idea because SQL doesn't support recursion and there is no query to find all managers above an employee.  These people have alternative ideas (like the employee has a list of managers) however they all seem to involve a mess of unnormalized data that is extremely hard to maintain.</p>
  
  <p>So what do you all think?</p>