In terms of performance and scalability which one would be a better method to do one to many mappings in MySQL.
Using a separate column but sticking to 2 tables:
(person) : id, name
(phone) : id, number, type, person_id
Using a separate table:
(person) : id, name
(phone) : id, number, type
(person_phone) : id, person_id, phone_id
There's only one correct answer to this, and it's the first one.
The second of your ideas is how you model many-to-many relationships, not one-to-many.
In terms of performance it is always cheaper to avoid joins, which add multiplicity to the amount of rows to be queried.
As long as a single phone will only be used by one employee (a true one-to-many) the first option is best.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With