Relationship

M

Matt W.

I have 2 tables. Peoplesoft_data which contains employee info and GC which
contains course info. The primary key in both of these tables is the
employeeID. I need to relate these 2 tables as a one-to-many, with the GC
table on the many side. What is the easiest way to do this?

any advice appreciated.

Thanks,
Matt
 
T

Tim Ferguson

I have 2 tables. Peoplesoft_data which contains employee info and GC
which contains course info.

First of all, your naming system needs a severe looking-at. Tables about
people really should be called People, and tables about courses should be
called Courses. It soulds as though you need another table called
Registrations to record which People are registered on which Course.
The primary key in both of these tables is
the employeeID.

I don't understand how a table that contains "course info" would even
have an EmployeeID in it, never mind how it would use it as an
identifier... Surely it should be something like ProspectusCode or
CourseNumber or something?
I need to relate these 2 tables as a one-to-many, with
the GC table on the many side. What is the easiest way to do this?

Unless you have a very exclusive teaching policy, I would humbly guess
that it's many-to-many. This is implemented by having a Registrations
table with field that look like this:

Student ' foreign key references People.EmployeeID
CourseNum ' foreign key references Courses.CourseNumber

and, optionally, something like

FeePaid
DatePaid
FinalMark
GraduatedOK
NumberOfSeminars
PersonalTutor

etc etc. The Primary Key of this table would be the combination of
(Student, CourseNum) ensuring that each student could only be registered
on a course once.

Hope that helps


Tim F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top