Design problems

  • Thread starter Thread starter Debbie
  • Start date Start date
D

Debbie

I am trying to create a database to store the classes that
students have taken and their grade if they have taken the
class.
My first thought is to have 3 tables:
Student: studentID, Name, address, etc.
Course: courseID, title, credits
Enrollment: courseID, term, studentID, grade

When set up in this manner, I either get duplicate records
or I only see the courses that the student has a grade
for. (when doing queries)

Any suggestions?
 
I am trying to create a database to store the classes that
students have taken and their grade if they have taken the
class.
My first thought is to have 3 tables:
Student: studentID, Name, address, etc.
Fine. Define StudentID as the primary key. This table stores values that are
common to the student, regardless of any course or result.
Course: courseID, title, credits
Fine. Define CourseID as the primary key. This table stores values that are
common to the course, regardless of any students on it.
Enrollment: courseID, term, studentID, grade
Fine. Define the first three fields as the (so-called "composite") primary
key. This table stores values that are specific to a particular student in a
particular term of a particular course; for example, the grade that got,
that term, for that course.

When set up in this manner, I either get duplicate records
or I only see the courses that the student has a grade
for. (when doing queries)

Read-up on "outer joins". Then show us the SQL text of your queries.

HTH,
TC
 
Back
Top