I want to create a database driven menu with multiple levels, but I'm not sure what the best practice is in designing the database table(s). I've done some searching, but can't find much relevant information.
Initially, I had thought to create a table for each level. For instance, the parent level menu would simply be dbo.Menu
with the immediate children menu items housed in dbo.SubMenu
. With that said, I envisioned the following design for dbo.Menu
:
However, once I began populating this table, I realized that the site will have some items with a depth of 3, and there is potential for adding more levels later.
Is there a best practice for designing a dynamic menu? Should I have one table containing all menu items or should I separate the menu items into multiple tables?