So basically, the parent_id would be used to reference the parent object (parent_id is just a reference to another item_id in the same table). If an item doesn't have a parent_id specified then that item is assumed
to be a parent/root level element.

The problem with this design I have found is that it doesn't allow a multi-level structures to be created, like in my example above.

I will be storing references to physical files on a machine, in a folder structure. Each file (in the database) will need to be put into a folder of some sort (as files will not be allowed to be stored at the root level--as in, not in a folder--in the design I have come up with), but it could be just one folder deep, or a few folders deep.

This is basically going to be a system for cataloging image files and sorting them into folders.

How can model something that would let me store this structure above with the Photos example where I can have a elements a few levels deep, yet
store it in a database table? Do I need to maybe start looking at XML databases rather than your typical relational database? I am familiar with general database design, but storing data like into a structure in a table is not something I've really dealt with (at least, not with more than one level possible).

Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.