I am building a system where there are properties and prospects, I have a table for both, but as I see this as a many to many relationship, I have created a table called prospect_property with two columns prospect_id and property_id, these are both/composite primary key(s).
What I am having problems with is setting the foreign keys and binding it all together. I figure the composite key should be the foreign key on the other two tables (or is it the other way around), but when trying to create that relationship in Management Studio, I have to reference one to one field, but I have one vs. two…
How am I supposed to set the relationship between these tables so that I for a prospect can see all properties and for a property can see all prospects?
SQL SERVER 2012 (Express)
1 Property –> several prospect_property (link on PropertyId on both sides)
1 Prospect –> several prospect_property (link on ProspectId on both sides)
Property: PropertyId is PK
Prospect: ProspectId is PK
prospect_property: composite PK made of PropertyId and ProspectId
PropertyId is FK to Properties and ProspectId is FK to Prospects
There is no more than this. The rest wil be done by buiding a few views linking all that togheter.