SQL Server database redesign ideas -
i have table contains list of menu items. menu item table related 5 other tables menu content table, menu download table. right got new requirement add 1 more layer saying each menu can associated multiple technical codes. looking optimized db restructuring without affecting existing data.
menu table:
menuid menuname ---------------- 1 menu1 2 menu2
menu content table:
menucontentid menuid menucontent --------------------------------- 1 1 contentsss 2 2 content2
now need add new relation techcode
. each menuname
can have 2 versions. application in production. thinking optimized way redesign database , application.
first approach adding code , adding tech_code
menuitem
table , group based on code.
menuid code menuname tech_code ------------------------------- 1 m menu1 2 m menu2 b 3 menu3 menucontentid menuid menucontent --------------------------------- 1 1 contentsss 2 2 content2
2nd option create parent table , when query data query using parent table id
parentmenuid menuid ------------------- 1 1 1 2 menuid parentmenuid menuname tech_code ---------------------------------------- 1 m menu1 2 m menu2 b 3 menu3
3rd design (add tech_code
referencing tables)
menuid menuname ----------------- 1 menu1 2 menu2 menucontentid menuid menucontent tech_code ---------------------------------------------- 1 1 contentsss 2 2 content2 b
which best way implement this? please give me suggestions.
here can specify code type: tech code or menu code or .... etc
each menu has code + content
and if want menu have 2 types of codes @ same time, can have 2 tables codelist "menucodelist" , "techcodelist" , remove codelist , add ids menu_code_content , no need codetype if needed "menucodelist" , "techcodelist" tables alone
Comments
Post a Comment