Question

Currently, in my Database Design class, we are at the database modeling stage. We received a sheet which gave a description of something and the associated model. There is one part that confuses me.

I uploaded a picture of that part of the diagram, along with the part of the question that confuses me. There must be something I misunderstand, but I am not entirely sure what. I'll greatly appreciate any help that is given. :D

This is the part of the question that confuse me:

“A department controls a number of projects” and “An employee may be assigned to a department and may work on several projects”

Here is the link to the part of the picture of the diagram where I am confused. I could not post the image directly because I do not have ten reputation points

http://i.stack.imgur.com/S69fB.jpg

Looking at the model that we are given, this is what confuses me. I'm assuming that each entity is a table, where the key in the table is the foreign key:

“A department controls a number of projects”

There is an identifying relationship between the Department and Project entities. One of the foreign keys in Project is dept, which I assume is deptNumber from Department. How can a Department work on multiple projects? If I understand it correctly, the deptNumber can appear only once in the Project table because it is a primary key. How can a Department work on multiple Projects if deptNumber can appear only once in Projects? Or is it a the combination of keys that can appear only once? Meaning that (deptNumber 1, Project 1) and (deptnumber 1, Project 2) can both appear in the Project entity? Assuming that'd a combination of keys can appear only once, then the reason why I misunderstand the Employee Relationship and Works for the same reason.

Was it helpful?

Solution

Your final assumption is true.

In your diagram the Project table has a compound Primary Key (dept, projectNumber). It means that the combination of the fields values should be unique. It is not the same as two unique fields. The values: (dept: 1, projectNumber: 1) and (dept: 1, projectNumber 2) mean that Department 1 works on two projects: Project 1 and Project 2.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top