Results 1 to 2 of 2
Nov 5, 2003, 12:25 #1
one to many relationship database
In Kevin Yank's book "Build your own database driven your website using php and mysql" (2nd edition) the author explains one to many relationship database with the example one author/many email addresses in page 93.
He advices never overload a table field to store multiple values...so he solves it with two separate tables:
1-Table authors with the fields: id and name.
2-Table emails with the fields: id email and aid.
aid is a number which coincide with id number in order to match both them.
well...I have thought other solution and i“d like to know if i am wrong or not.
1-A unique table called details with fields: id mail and name.
Example of stored rows in my solution:
id=1 email@example.com name=Maria Smith
id=2 firstname.lastname@example.org name=Maria Smith
id=3 email@example.com name=Marķa Smith
As we see...this solution does not overload a table field...only repeats...XDD
Is it possible this solution?
Regards from Spain.
Nov 5, 2003, 12:31 #2
- Join Date
- Oct 2002
- 0 Post(s)
- 0 Thread(s)
well, this is just not considered efficient since you are storing the name "Maria Smith" many times in many rows. It would work but it would be much faster to simply store the name Maria Smith in one table and then refer to her id in the other table...- website