Reputation: 77
I'm just teaching myself databases, and I'm trying to model an existing problem in relational form. It's a bit messy, but simplified:
I have one Foo
table, which contains lots of Foos
, and each Foo has a one to many link to lots of Bars
through BarID
. Trouble is, one Bar might also have a one to many relationship to lots of other Bars, and I can't think how to model this and avoid nasty queries. Any advise welcome.
Foo [ FooID … BarID ]
Bar [ BarID … OtherBars??]
Upvotes: 1
Views: 125
Reputation: 1361
U can have tables like this:
FooMaster[FooId, and other foo cols but no barid]
FooBarRel[Fooid, Barid]
BarMaster[Barid, and other bar details but no barid of other bars]
BarBarRel[Barid, RelBarid]
Upvotes: 2