A table represents a single "entity". In this case, it probably makes most sense to store the users.lastname
in the same table.
On the other hand, suppose a user can have many phone numbers. In this case, it is better to normalise the database and store this data in a separate table.
In other words, you want to avoid doing something like this:
users.phone_number_1
users.phone_number_2
users.phone_number_3
The key issues with this approach (as explained in more detail by the above link) are:
- You'll have lots of redundant columns, for must users. This causes wasted storage space, and decreased performance.
- You need to keep adding new columns if a user goes over the limit (e.g. 3 numbers, because there are 3 columns).
- Querying the data gets much harder. For example, suppose you want to query "all users who have phone number X" -- you now need to search across multiple columns!
Instead, create a separate phones
table - which is joined the the user by a user_id
column.