If I had a hierarchical database containing 3 tables: course, students, grades

Course would be the root table and may have 10 course records in there.

Each course has its own selection of students, if the record doesn't contain keys like a relational database, how does it know which records for the students table are for which course?

Does it work like this or am I mistaken:

Courses Table:
Name : Length : Teacher
Example : 1 : Sir Example
Example2 : 1 : Sir Test

If I wanted to view the students in the example course, I would select this and it then shows the students table for this course.

It would be like the Windows file system, the records work like folders except display the data and are able to be opened to then show the children tables.

Course 1 > Example > Students

My experience was with IBM IMS. The root held file offset pointers to locate its children, which in turn held pointers to their children, and so forth. The nearest equivalent in the relational world is Row Identifiers (RIDs) which are sometimes used to link the leaves of BTree indexes to the table row.

The analogy with Windows file system is not a bad one, in terms of the nesting and how access to lower items is through higher ones. The idea of a table doesn't really work, however. It may be better to think of it like a JSON document in a NoSQL store that has been shreaded by the DBMS and then internally linked through file pointers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.