Hi.
My application uses some kind of "virtual folders" so I need to store the tree structure in the database. The table holding the data is quite simple, it has 3 columns:
- id_folder (int, primary key)
- id_parent (int, references id_folder)
- folder_name (string)
My question is: which is the best way to implement the root?
- Making id_parent nullable; the root will be the folder with id_parent=null, or
- Making the folder to be its own parent, i.e., id_folder=id_parent.
Thank you.