Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
samir.first
Starting Member
34 Posts |
Posted - 2014-08-06 : 02:49:15
|
I have main table and other 12 tables .i have to create relation table with relation type many to manyfor each table of the 12 tableswhat is the best design to solve that.1- create one table (ID , MainID , TrxID , TableID) TrxID have no relation .2- create 12 tables Contain (ID , MainID, TrxID) TrxID have relation with it's table.3 - Create one table having 12 columns for relation for each table (ID , MainID , TrxID_Table1,TrxID_Table2,TrxID_Table3,....ect) having 11 null values for each inserted row.what is the best design to solve that. |
|
Bustaz Kool
Master Smack Fu Yak Hacker
1834 Posts |
Posted - 2014-08-06 : 11:17:49
|
I'm afraid that I don't quite understand your question. Perhaps some specifics would bring the issue into focus. If I do understand you, there is a main table which has a many to many relationship with each of twelve other tables. My first response would be that you'd need a junction table for each of the twelve table relationships; one to connect Main with Table1, another to connect Main with Table2, etc.). I am assuming that each of the twelve tables are independent of each other but, again, I may simply be missing your issue entirely. Too often we enjoy the comfort of opinion without the discomfort of thought. - John F. Kennedy |
|
|
samir.first
Starting Member
34 Posts |
Posted - 2014-08-07 : 16:59:22
|
Thank you Bustaz Kool,and I Will explain to you in detail There are 12 screen for each screen her tableTable 1ID Date ValueTable11001 12-07-2014 100Table 2ID Date ValueTable21255 14-07-2014 2000Table 3ID Date ValueTable31366 18-07-2014 500...etcAnd I have TableMainTableMainID Date MainValue210 12-07-2014 100211 14-07-2014 2000212 18-07-2014 500what is the best design to reference Between MainTable And 12 table .===================================================First CaseCreate 12 Table Relation IDTable1 IDTableMain1001 210And IDTable2 IDTableMain .... etc1255 211Or second CaseCreate One TableIDTable TableType IDTableMain1001 1 2101255 2 2111366 3 212Or Third CaseCreate One Table IDTableMain IDTable1 IDTable2 IDTable3 ... etc210 1001 NULL NULL211 NULL 1255 NULL212 NULL NULL 1366Please Help for best Design |
|
|
Bustaz Kool
Master Smack Fu Yak Hacker
1834 Posts |
Posted - 2014-08-07 : 17:29:05
|
I'm sorry but I simply don't understand what you are trying to accomplish here. I don't see any many-to-many relationships. What does the Main table represent? What do each of the twelve tables represent? I'd like to help but you have got to make it easy to be helped. Too often we enjoy the comfort of opinion without the discomfort of thought. - John F. Kennedy |
|
|
MohamedAliSalim
Starting Member
9 Posts |
Posted - 2014-08-09 : 04:18:16
|
Is this you want ?What is the best design of your table ?Or is there other best design??[url]http://www.4shared.com/file/PJ5hGf9nba/design_1.html[/url][url]http://www.4shared.com/file/d7REgYsxce/design_2.html[/url][url]http://www.4shared.com/file/a1bAKRXUce/design_3.html[/url]All in one[url]http://www.4shared.com/file/V21LUNuXce/designs.html[/url]Mohamed Ali Salim |
|
|
samir.first
Starting Member
34 Posts |
Posted - 2014-08-09 : 04:21:07
|
Thank you Eng Mohamed Aliyes , this is what i want Eng Bustaz Koolplease check Eng Mohamed Ali URLs |
|
|
|
|
|
|
|