SamMaynard
Board Regular
- Joined
- Dec 4, 2002
- Messages
- 106
There could be many answers to this question and I would sure appreciate anyone's input. I realize it will take minute to read and answer. I am fairly new to database design and haven't been able to answer my question by reading.
I'm creating a database to track college student records over time. I track when they Graduated, GPA, Starting Salary, Company Name, Major/Minor ContactPerson (like mom or dads name and phone number incase we need to reach them in the future) and so forth. I have a table called StudentInfo. Its primary key is StudentID. I have other supplementary tables such as Company, Majors, Contacts, and so forth. I validate my StudentInfo table from these supplementary tables. (They are also related with referential integrity enforced)
Ok, here is the problem...What if a student goes to work for two companies. Or what if I want to enter more that one contact name or what if I want to add 20 or 30 contact names. How can I do this with out hard coding lots of field into my tables?
The best I have come up with is a many to many relationship between the different tables. For example I could have a junction table called StudentDetails with one to one relationships enforced to the other tables like Company, Majors, Contacts. This way I could have as many companies or contacts as I want but what if the student didn't find a job and therefore no value goes into the company field.
In this case I could have an option for the user to input 'No Company' or something but it seem there should be a better way of achieving what I'm trying to do.
Now this was long. Thanks for reading all of it. I would appreciate your thoughts. Any design help be appreciated. I want this database as normalized as possible. Thanks, Sam
I'm creating a database to track college student records over time. I track when they Graduated, GPA, Starting Salary, Company Name, Major/Minor ContactPerson (like mom or dads name and phone number incase we need to reach them in the future) and so forth. I have a table called StudentInfo. Its primary key is StudentID. I have other supplementary tables such as Company, Majors, Contacts, and so forth. I validate my StudentInfo table from these supplementary tables. (They are also related with referential integrity enforced)
Ok, here is the problem...What if a student goes to work for two companies. Or what if I want to enter more that one contact name or what if I want to add 20 or 30 contact names. How can I do this with out hard coding lots of field into my tables?
The best I have come up with is a many to many relationship between the different tables. For example I could have a junction table called StudentDetails with one to one relationships enforced to the other tables like Company, Majors, Contacts. This way I could have as many companies or contacts as I want but what if the student didn't find a job and therefore no value goes into the company field.
In this case I could have an option for the user to input 'No Company' or something but it seem there should be a better way of achieving what I'm trying to do.
Now this was long. Thanks for reading all of it. I would appreciate your thoughts. Any design help be appreciated. I want this database as normalized as possible. Thanks, Sam