extra DB field

Results 1 to 3 of 3

Thread: extra DB field

  1. #1
    Troy Guest

    Default extra DB field

    Should I create an extra autonumber field as a primary key instead of using multiple fields. I cannot explain this well so here is an example.<BR><BR>I have four tables, users, tests, usertest, and testHistory. They break down like this.<BR><BR>users<BR> userID -- only thing relevant<BR><BR>tests<BR> testID -- only thing relevant<BR><BR>usertests<BR> usertestID<BR> testID<BR> userID<BR> dateCreated<BR> timeCreated<BR><BR>testHistory<BR> usertestID<BR> or<BR> testID<BR> userID<BR><BR> answer<BR> date<BR> etc..<BR><BR> <BR>Would it be better to use the "usertestID" field or to use both "testID" and "userID" fields to reference a specific test in the testHistory table?

  2. #2
    Join Date
    Dec 1969

    Default Well...

    To make maintenance easier, yes, it would be a good idea to add a counter to your test history table.<BR><BR>-- Whol

  3. #3
    Join Date
    Dec 1969

    Default RE: extra DB field

    I imagine that there should only be one row per user/test in testHistory table. The nice thing about putting the primary key on these fields is that it forces the integrity of your data.<BR><BR>That&#039;s how I would do it. I don&#039;t see how it makes "maintenance" easier to have one field. It might make your queries one line shorter, but... the two field pK is more logical to me.

Posting Permissions

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