Forum Moderators: open

Message Too Old, No Replies

Database design question from a newbe

newbe question

         

UnEmployedAfterSchoo

2:09 pm on Sep 29, 2006 (gmt 0)

10+ Year Member



Forexample I have there tables: student, courses, professors.
Student table has column student_id, courses table has column course_id, professor table has column professor_id. I need to build a table or tables that provide student, course, professor relationships.

Is it better to create the following:

Two tables with as follows:
student_course_relation table with columns : student_id, course_id
course_professor_relation tabel with columns: course_id, professor_id

or

One table with as follows:
student_course_professor_relation with columns: student_id, course_id, professor_id. Here half of the records of student, would not have a professor_id, and other half of the records of professor would not have student_id.

Which is better?

zomega42

3:48 pm on Sep 29, 2006 (gmt 0)

10+ Year Member



The first one. Why mix up two different data sets in one table.

Actually this is just my best guess, it really depends more on what you will use the data for. If your application will treat students and profs as more or less the same, then the second might be better.