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.
My solution:
1-A unique table called details with fields: id mail and name.
Example of stored rows in my solution:
row1:
id=1 mail=blabla@hotmail.com name=Maria Smith
row2:
id=2 mail=frer@terra.es name=Maria Smith
row 3:
id=3 mail=gret@ono.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.
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...
Bookmarks