Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2002
    Location
    Wyoming
    Posts
    48

    Unanswered: Help Deciding Primary Key(s)

    I have a database that is being used to track student attendance among other things. In this database is a table tbl_Attendance which stores the Date, StudentID, and Attendance_Code (i.e., EA = Excused Absence, etc.)

    I am not sure what the primary key should be. A given student will appear many times in a year but can only appear once for any given date. Should the combination of Date and StudentID be the key?

    Also, I am only tracking the exceptions. If a student attends school for the entire day, they will not appear in tbl_Attendance.

    Thanks for your thoughts!
    Cheers,
    Ken

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713

    Re: Help Deciding Primary Key(s)

    Originally posted by KennyG
    I have a database that is being used to track student attendance among other things. In this database is a table tbl_Attendance which stores the Date, StudentID, and Attendance_Code (i.e., EA = Excused Absence, etc.)

    I am not sure what the primary key should be. A given student will appear many times in a year but can only appear once for any given date. Should the combination of Date and StudentID be the key?

    Also, I am only tracking the exceptions. If a student attends school for the entire day, they will not appear in tbl_Attendance.

    Thanks for your thoughts!
    You could create your key based on the Date and student ID -or- you could assign a unique ID for each attendance record ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •