DBAsupport.com Forums - Powered by vBulletin
Results 1 to 9 of 9

Thread: Primary vs alternate key

Threaded View

  1. #6
    Join Date
    Sep 2000
    Location
    VA
    Posts
    343
    Yes AK can be used for foreign key reference. I am currently doing that wherever possible as the PK is a varchar2(1000).

    If I need to reference this PK in another table, how about making it an AK in the reference table ? e.g.

    Table1
    A varchar2(1000) - Primary Key

    Table2
    A Varchar2(1000) - references to Table1
    B Number
    A & B Combo is unique in Table2.

    For the above scenario, I hate to make 'A' in table2 as part of the primary key due to its size. Since I need to enforce the uniqueness, can I make it part of the AK or since there really is no difference between AK & PK as far as storing/indexes goes, it does'nt impact whether 'A' is part of the PK or AK in Table2 ?

    In other words, which of the following is a better design :
    Table2
    A Varchar2(1000) - (FK) (PK,1)
    B Number (PK,2)
    OR
    Table2
    A Varchar2(1000) - (FK) (AK,1)
    B Number (AK,2)

    Thanks,
    Shiva.
    Last edited by rshivagami; 03-17-2004 at 10:58 AM.

Posting Permissions

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


Click Here to Expand Forum to Full Width