|
-
Nov 6th, 2006, 07:09 AM
#13
Thread Starter
Addicted Member
Re: Database desigining confusion {please help}
 Originally Posted by si_the_geek
It doesn't matter how many people have visited how many countries.. the "PersonCountry" table will store all combinations, using one row per visit. If you want to add a country to the list of where a person has visited, simply add a new row; if you want to remove a country, simlpy delete the row.
The table would contain data like this (a re-arranged version of the data you posted above):
Code:
PersonCountry
PersonID CountryID
3 1
3 2
3 3
To find all of the countries that a person has visited, you would use an SQL statement like this:
Code:
SELECT Country.Name
FROM Country
INNER JOIN PersonCountry ON (PersonCountry.CountryID = Country.ID)
WHERE PersonCountry.PersonID = 3
(replace 3 with the ID of the person)
I understand it totally and its fine but wouldn;t it create heavy database and too many records ?
for 100 persons with 50 visits in this i have to create 5000 records while in {1,2,3...} method it would require only 100 records?
please enlighten me little more about this issue
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|