Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2008
    Location
    All over, Now in Missouri
    Posts
    73

    Unanswered: Checking for Duplicate Records

    Having issues thinking the logic over this.

    TableA: Personnel (Primary Key) PIdNum
    TableB: Classes (Primary Key) ID, (Foreign Key) PIdNum, (class attened) InstClass
    - One to many Relationship (1 person may have many classes)

    Problem:
    - I dont want Person A to have the same class entered any more than 1 time!

    How can I check the table to see if a new record (dancing class) has already been entered for Person A. Cannot make InstClass a Primary key.

    - Check with DAO?

    Peter
    We tend to look at Linear paths which can lead us to a path of resistance!

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    so make the pk a composite of class and person...

    what you probably need is an intersection table
    what you have at present isn't normalised
    Fundamentals of Relational Database Design -- r937.com
    The Relational Data Model, Normalisation and effective Database Design

    ditch the id column, you only need an id column when there is no obvious other candidate key (there is) or where the obvious candidate key woudl be tortuously complex or prone to changes (it isn't).
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You can also add a Unique index on the column PIdNum.
    Have a nice day!

Posting Permissions

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