Creating nodes and sub-nodes from database table For example I have a database table defined from the following SQL.

CREATE TABLE IF NOT EXISTS `mytable` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `base_id` int(11) NOT NULL,
  `page_type` smallint(4) NOT NULL,
  `page_title` varchar(50) NOT NULL,
  `page_content` text NOT NULL,
  `previous_id` int(11) NOT NULL,
  `next_positive_id` int(11) NOT NULL,
  `next_negative_id` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;  


I need to create nodes/content by using records inside that table. For example I have a base node, its id is 1. I get its title and its content from mytable. Inside this page I ask a question: "Do you like cats?" If the user selects yes, I send him to sub-node. I get sub-node address, title and content from mytable. You can see the flow like the below. Until the latest sub-node I give options to user. He selects YES or NO and sees relevant content/sub-node.

How can I make it with a Drupal 7 site?
I have another Drupal website but I have never used such complex flow. I created nodes and used contributed modules. Is it so hard to make this flow? Which modules should I use to setup such hierarchy and content management?
One solution would be to create a new content-type, let's call it Question-Page and the install Entity Reference, which provides a field type that can reference other nodes. Then you could add three new fields for previous_id, next_positive_id and next_negative_id.



To import the data from your table I think you could use the Feeds module. First create one importer that will create the actual nodes. Second an importer that will update each node and set the node reference fields.


First importer that will only create all nodes.





Second importer, that will setup the reference fields.