title: DataBase (datamodel) to build a folder structure
body: <p>Planning on building a Folder based structure in Java. </p>
  
  <p>I will be using a jquery plugin for the GUI, so I don't need need information on how to display the folder structure.</p>
  
  <p>I am looking for the backend logic on how folder information is stored, such that it can be retrieved in a quick and efficient manner.</p>
  
  <p>Each folder will have multiple subfolders.
  From a leaf folder, we should be able access the root quickly and efficiently</p>
  
  <p>Example:</p>
  
  <pre><code>+Folder1
    |__SubFolder1_1
    |__SubFolder1_2
          |_SubSubFolder1_2_1
          |_
  +Folder2
    |__SubFolder2_1
          |_SubFolder2_1_1
          |_SubFolder2_1_2
               |_SubFolder2_1_2_1
  </code></pre>
  
  <p>New folders could be added randomly.
  Folder can be renamed.
  Folders can be deleted.</p>
  
  <p><strong>My Question is:</strong><br></p>
  
  <p>How would these folder details be stored in the database?</p>
  
  <p>Again, I am looking for a fast and efficient means of storing and retrieving this information. </p>