I have a need to build a schema structure to support table of contents (so the level of sections / sub-sections could change for each book or document I add)…one of my first thoughts was that I could use a recursive table to handle that. I want to make sure that my structure is normalized, so I was trying to stay away from deonormalising the table of contents data into a single table (then have to add columns when there are more sub-sections).
It doesn’t seem right to build a recursive table and could be kind of ugly to populate.
Just wanted to get some thoughts on some alternate solutions or if a recursive table is ok.
Thanks,
S
It helps that SQL Server 2008 has both the recursive WITH clause and hierarchyid to make working with hierarchical data easier – I was pointing out to someone yesterday that MySQL doesn’t have either, making things difficult…
The most important thing is to review your data – if you can normalize it to be within a single table, great. But don’t shoehorn it in to fit a single table setup – if it needs more tables, then design it that way. The data & usage will show you the correct way to model things.