I would like to convert this segment of an ER-Diagram to a relational model. We have a ternary relationship and what it says is the following:
- 1 Customer gives 1 Project to -> multiple Developers
- 1 Customer assigns 1 Developer with -> multiple Projects
- 1 Developer is assigned 1 Project by -> ONE Customer
A proposed solution would be this:
Assignment(EmployeeID, CustomerID, ProjectID)
where the primary key is composed of EmployeeID, CustomerID and ProjectID. And all of those attributes are foreign keys, each one refering to its respective entity.
But this solution is plain wrong as it doesn't express the same thing as the ER-Diagram. We have a composed primary key, so that means that the COMBINATION of those three things is UNIQUE. That implies that I can have the same ProjectID, with the same EmployeeID but given by a different CustomerID (which I do not want).
How do I resolve this?
EDIT: As many users find that the bullet points haven't clarified anything, I will give a short textual description of the concept of the relation:
- A single customer can give away one or more projects
- A single project can be given by ONE SINGLE CUSTOMER
- Each project can be finished by one or more developers
- Each developer can work on multiple projects (regardless of the customer by which the project was given)
For that purpose, I have concluded that it would be better to use two separate binary relations instead of a single ternary. See my answer below.
