View Single Post
Old 02-09-2008, 07:23 PM   #4 (permalink)
Alan @ CIT
Member of the Month
The Frequenter
Member of the Month Top Contributor 
 
Alan @ CIT's Avatar
 
Join Date: Apr 2005
Location: South UK
Posts: 483
Thanks: 51
Alan @ CIT is on a distinguished road
Default

I'm not sure what you mean by shared columns.

The idea behind using joins is to split data across multiple tables. For example, say you have a users table:

Code:
userid | username | password
----------------------------
1      | alan     | secret
2      | orc      | something
And you decide to store the users email addresses in a seperate 'emails' table:

Code:
emailid | address | userid
--------------------------
...more rows here...
15       | alan@example.com | 1
16       | orc@example.com  | 2
You can see that the 'userid' column in our 'users' table, matches the 'userid' column in our 'emails' table. If we wanted to fetch a username and their email address, we would do a join across the two tables using the 'userid' column to get the data we wanted.

Is this what you meant by shared columns?

Alan
Send a message via MSN to Alan @ CIT
Alan @ CIT is offline  
Reply With Quote