Perad Posted August 5, 2008 Share Posted August 5, 2008 Could someone briefly explain what primary keys are? I use them all the time. Are they just a unique identifier for the record or do they have a deeper meaning? Futhermore I have recently heard the word 'foriegn key' bounded around. Anyone know what this is? Regarding the Query. I have 3 tables. Users Groups Tax They look something like this. Users - id - name - pass - email Groups // Stores Members/Groups relations - user_id - group_id Tax // Stores name/id relationships. In this case type=Group; name=Group Name; tax_id=group_id - tax_id - type - name What I want to do is get userdata. This includes group data. Whats the best way to query the username, get the group the user is a member of, get the name of that group? Quote Link to comment Share on other sites More sharing options...
fenway Posted August 6, 2008 Share Posted August 6, 2008 A primary key is simply a unique identifier of a record -- for example, if you had records with SSNs, you might not need to add a UID field (a.k.a. a surrogate key). As for the 2nd question, you simply need to join by following the *_id fields. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.