Composite Foreign Key from multiple related tables

SpaMaster

New Member
Just beginning to learn about SQL and had a question I couldn't figure out.I have a setup based on the following tables and their primary keys, the columns with the same name between tables are constrained by foreign keys:\[quote\] Company:
  • CompanyId
Division:
  • CompanyId
  • DivisionId
Resource:
  • CompanyId
  • ResourceId
DivisionResource :
  • CompanyId
  • DivisionId
  • ResourceId
\[/quote\]
  • DivisionResource is used to create a many to many relation between division and resource and constrain them so that divisions can only be linked to resources of the same company.
  • Without the DivisionResource, Division and Resource wouldn't need the CompanyId as a primary key to contain unique records.
So my question is this: Is there a way to create a similar constraint as DivisionResource creates without forcing Division and Resource to have an extra column in its primary key?
 
Top