I want to create a database like Dmoz(dmoz.org).
I have a problem with creating parent child relation.
I want to create parent child relation. This parent child relation will be assigned to a 'links' table. In the links table I will insert data whether in root category or subcategory of sub-subcategry.
What is the best method to do this relation??

Recommended Answers

All 2 Replies

I am not sure you need a links table for such a simple structure.

Ensure each row has a unique id, include a column named something like parentId to hold the id of the parent record.

I had a look at that website, it looks like a many-to-many relationship in which case you will need a links table to normalise it.

The table can be simple with two columns one for parent rowid and child row id. When you are displaying the child records you do a join on this table to the child rowid and filtering on the parent rowid.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.