SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Multiple id's in database
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Esanders323
Starting Member

2 Posts

Posted - 11/03/2013 :  22:22:14  Show Profile  Reply with Quote
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

Thanks!

waterduck
Aged Yak Warrior

Malaysia
961 Posts

Posted - 11/03/2013 :  22:54:17  Show Profile  Reply with Quote
plausible =P
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 11/04/2013 :  00:24:07  Show Profile  Reply with Quote
you can use separate id values for both supporter and person. similarly for staff,member etc

each of those tables will have pid as foreign key which will refer back to their person details.
so record of pID = 26 and supporter ID = 5 means its 5th supporter whose is actually 26th person. there's no issue with that

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

Esanders323
Starting Member

2 Posts

Posted - 11/04/2013 :  00:49:20  Show Profile  Reply with Quote
Great thank you for the clarification!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 11/04/2013 :  02:32:53  Show Profile  Reply with Quote
you're welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.09 seconds. Powered By: Snitz Forums 2000