Suppose you have to build a DB tables that depicts states and their borders between each other. Let's say the States table would look like:
States: Name(PK), Size, etc...
What would be the appropriate way to define the relationships (borders) between states?
I came up with three alternatives -
- Defining a Borders table with primary key combined by two fields: Id(PK), StateName(PK,FK)
- Defining a Borders table with StateName1(PK,FK), StateName2(PK,FK)
- Defining a Borders table with a concatenated value of two states' names.
Some more information:
- I am going to query the data as follows:
someState.HasBorderWith(State anotherState)
- I use EF 4.0 with POCO entities.