954,597 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Please help me wiht this MySQL problem

Hi,
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??

moneypro
Newbie Poster
11 posts since Aug 2011
Reputation Points: 10
Solved Threads: 0
 

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.

ChrisPadgham
Posting Pro in Training
413 posts since Sep 2009
Reputation Points: 102
Solved Threads: 78
 

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.

ChrisPadgham
Posting Pro in Training
413 posts since Sep 2009
Reputation Points: 102
Solved Threads: 78
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: