02-09-2008, 07:23 PM
|
#4 (permalink)
|
|
The Frequenter
Join Date: Apr 2005
Location: South UK
Posts: 483
Thanks: 51
|
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
|
|
|