Jump to content
  • 0

Composite Key Fields


jenoble

Question

Hi,

I have a simple data structure to implement. I have 3 entities; Lecturer, Module and Allocation. A lecturer can have more than one module and a module can have more than one lecturer. This creates a many-to-many relationship which I've resolved by creating an additional entity called Allocation. Lecturer has a unique key called Staff ID, Module has a unique key called Module Code and Allocation has a unique key which is a combination of both of the others i.e. StaffID and ModuleCode. I've created 3 tables. Lecturer and Module are fine and I've set StaffID and Module Code as Unique, but I don't know how to prevent a user for allocating a lecturer to a module more than once in the Allocation table. i.e. how can I prevent duplicate entries based on two fields?

Any help would be gratefully received as the resolution of a many to many entity relationship is fundamental to almost all of the data apps we need to build. We hope to be able to use this as an alternative to Ms Access within this course I'm teaching.

Thanks

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...