Site map table design help (1 Viewer)

cygnusx197

New member
Local time
Today, 17:16
Joined
Sep 22, 2006
Messages
3
If you're building a database to represent a web site architecture, what's a good way to design the tables?

Would you make a table for parent sections, and then another table for the first child of those sections, and then another table for children of that child and so on? Sounds clumsy to me. What happens if a parent section can be drilled down into 15 pages deep? You'd need 16 tables.

What I'm doing is building a test plan manager for a site that has varying levels of depth in each parent category and I'm trying to decide how to develop the input/browse form.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 17:16
Joined
Feb 19, 2002
Messages
43,233
Since pages can appear multiple times at multiple levels in a web site, you need a many-to-many relationship. You have a table to hold pages and their details. The second table relates one page to another. Usually a m-m relationship takes two tables and relates them. In this case, it takes one table and relates it to a different row in the same table. So, you end up with something like:

Page1, Page2
Page1, Page3
Page1, Page4
Page2, Page5
Page2, Page6
Page3, Page7
Page3, Page4
Page5, Page6
etc, The left page is the "parent" and the right page is the "child" at that level.
 

Users who are viewing this thread

Top Bottom