Sometimes, hierarchical data is not represented by nested (hierarchical) data structures but is actually stored within a simple flat structure in normal database tables or flat files. The simplest form of hierarchical relationships in data can be presented as a table that has two fields: parent and child.
Look at the example of folder hierarchy on the disk (as shown in the following figure). The structure on the left is visually simple to read and understand. You can easily see what is the root folder and what are the leaves, and can easily highlight the specific branch you are interested in.
The table on the right is the simplest way to store the hierarchical relationships data in the flat format. This structure is extremely hard to query with the standard SQL language. Some databases like Oracle have special SQL clauses, which can help to query hierarchical data to be able to analyze it and present in an understandable and clear way. However, those hierarchical...