Results 1 to 4 of 4
  1. #1
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419

    Two key as primary

    Let’s say I have two key as primary.
    One is a date and the other is name.


    However the name could change due to naming convention changes but is still the same item and also due to careless spelling mistakes.

    Should I keep it as primary key but make sure the name is always consistent when upload or should I create another ID for the name in conjunction with the date becomes the primary key.

  2. #2
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    It's oft stated that PK's should never be meaningful data. Sounds like what you should have is a composite index and not a composite key, which seems to be what you're asking about. So to your final question - create a PK that is not related to the composite index. A simple autonumber id could suffice.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419
    But if we were to query the name, we can’t do group by to aggregate by name or where for the name. I thought is better to keep the name consistent instead.

  4. #4
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Afraid I don't grasp the meaning of that. If your name data is inconsistent due to spelling or any other reason, you'd simply end up with extra groups, and whether or not that actually happens depends on other factors, such as the use of LIKE operator, or the name is a PK in a table rather than a fk from some other table, or any of a host of reasons.
    If that's not what you mean, then you'll have to be more clear. You can still query on a field name if it's part of a composite index. If you're not familiar with such, then best you look it up to ensure you understand what they are.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Help with primary key
    By JimmyRN in forum Database Design
    Replies: 10
    Last Post: 07-31-2017, 09:42 AM
  2. Primary key
    By vugar in forum Access
    Replies: 15
    Last Post: 09-07-2015, 02:30 AM
  3. primary key
    By handsomealso in forum Access
    Replies: 1
    Last Post: 04-09-2013, 06:07 AM
  4. Primary Key
    By DukeBlue in forum Access
    Replies: 18
    Last Post: 09-23-2011, 05:23 PM
  5. Primary Key Help
    By phoenix13 in forum Access
    Replies: 4
    Last Post: 07-30-2009, 12:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums