Multiple ID's in database
Posted
by
eric
on Stack Overflow
See other posts from Stack Overflow
or by eric
Published on 2013-11-04T03:43:51Z
Indexed on
2013/11/04
3:53 UTC
Read the original article
Hit count: 163
sql
I have a database that contains a few tables such as person, staff, member, and supporter.
The person table contains information about every staff, member, and supporter. The information it contains is name,address,email, and telephone. I also created an id that is the primary key.
My issue is that I also have an primary key ID for staff, member, and supporter.
For instance, in the person table is John with id 1. He is a supporter so in the supporter table is pID(for person id)to reference back to John with all his information and ID(for supporter ID).
pID references to the person table and every person has an ID incremented by 1 starting at 1. supporter ID is for every supporter and also starts at 1 and is incremented by 1.
Is it possible to have in the supporter table pID = 1 and supporter ID = 1? Another person may have a pID = 26 and supporter ID = 5.
Or will supporter ID have to be different than the pID and be something like "sup"? So you would have pID = 1 and supporter ID = sup1 or pID = 26 and supporter ID = sup5
© Stack Overflow or respective owner