database design for dynamic menu bar I am trying to create a menu bar which will load dynamically on user log in, based on the user roles. Say if the user is an admin he can see all the items listed under the header and if a user is a guest he can see only few items e.g. Item 1.1, Item 1.2, Item 2.2, etc. The menu bar will be something like,



Header
  |_Sub-header_1
  |       |_Item_1.1
  |       |_Item_1.2
  |       |_Item_1.3
  |_Sub-header_2
  |       |_Item_2.1
  |       |_Item_2.2
  |       |_Item_2.3
  |       |_Item_2.4
  |_Sub-header_3
  |       |_Item_3.1
  |       |_Item_3.2
  |       |
  |



So there will be header and there will be 7 sub-headers, in sub-headers there could be 10-20 items. I want a database where I can store these items, sub-headers and header.

1) Please try to make me understand how to design a database for such scenarios? 
2) Also I want to create a url out of it, so how do I do that?
If you were using SQL Server, what you are looking for is something like:

USE tempdb;
CREATE TABLE MenuHeaders
(
    MenuHeaderID INT NOT NULL CONSTRAINT PK_MenuHeader 
        PRIMARY KEY CLUSTERED IDENTITY(1,1)
    , MenuText VARCHAR(255)
);
CREATE TABLE MenuSubHeaders
(
    MenuSubHeaderID INT NOT NULL CONSTRAINT PK_MenuSubHeader 
        PRIMARY KEY CLUSTERED IDENTITY(1,1)
    , MenuHeaderID INT NOT NULL CONSTRAINT FK_MenuSubHeader_MenuHeaderID 
        FOREIGN KEY REFERENCES MenuHeaders(MenuHeaderID)
    , SubMenuText VARCHAR(255)
);
CREATE TABLE MenuItems
(
    MenuItemID INT NOT NULL CONSTRAINT PK_MenuItems 
        PRIMARY KEY CLUSTERED IDENTITY(1,1)
    , MenuSubHeaderID INT NOT NULL CONSTRAINT FK_MenuItems_MenuSubHeaderID 
        FOREIGN KEY REFERENCES MenuSubHeaders(MenuSubHeaderID)
    , MenuItemText VARCHAR(255)
    , MenuURL VARCHAR(2048)
);
CREATE TABLE Users
(
    UserID INT NOT NULL CONSTRAINT PK_Users 
        PRIMARY KEY CLUSTERED IDENTITY(1,1)
    , UserName VARCHAR(255)
);
CREATE TABLE UserGroups
(
    UserGroupID INT NOT NULL CONSTRAINT PK_UserGroups 
        PRIMARY KEY CLUSTERED IDENTITY(1,1)
    , UserGroupName VARCHAR(255)
);
CREATE TABLE UsersGroupsXRef
(
    UserID INT NOT NULL CONSTRAINT FK_UserGroupsXRef_UserID 
        FOREIGN KEY REFERENCES Users(UserID)
    , UserGroupID INT NOT NULL CONSTRAINT FK_UserGroupsXRef_UserGroupID 
        FOREIGN KEY REFERENCES UserGroups(UserGroupID)
    CONSTRAINT PK_UsersGroupsXRef PRIMARY KEY CLUSTERED
);
CREATE TABLE UserGroupsMenusXRef
(
    UserGroupID INT NOT NULL CONSTRAINT FK_UserGroupsMenusXRef_UserGroupID 
        FOREIGN KEY REFERENCES UserGroups(UserGroupID)
    , MenuHeaderID INT NOT NULL CONSTRAINT FK_UserGroupsMenusXRef_MenuHeaderID 
        FOREIGN KEY REFERENCES MenuHeaders(MenuHeaderID)
);


This allows you to have Menus linked to Sub-Menus, with Menu-Items linked to Sub-Menus.

Users can be members of UserGroups, and UserGroups have associated Menus.

MenuItems have a URL field.