I am looking to implement a data-driven wizard with the question tree stored in an Oracle database. What is the best schema to use to make the database portion flexible (i.e. easy to add new paths of questions) without sacrificing too much in terms of performance?
Share
You can build a tree structure using a foreign key that references the same table (a ‘pig’s ear’ relationship as it is often known). Then you can use the CONNECT BY syntax to traverse the tree. Here is a simple example:
Note how the special keyword LEVEL can be used to determine how far down the tree we are, which I have then used to indent the data to show the structure.