sql for testing menu and submenu dynamism