I’m modelling MySQL database for an website.
I’m now making ‘people’ table, and deciding what columns needed.
a person has a name column,
and I want to add alias column, which contains the names in various conventions.
for example, a person whose name is ‘Micheal Jackson’ may have aliases like ‘M. Jackson‘,
‘Jackson, M’, or ‘M.J.’.
Anyway, each person can have different number of aliases, then What data type could be rational?
Make alias field as a Varchar, and put every aliases in it, and split them in PHP?
or make aliases dynamically from name in PHP? instead of putting it in DB?
I’m waiting for good recommendations, Thanks!
Make a new table and call it
aliases. This table should have a Many-To-One relation with your tablepeople.The table
aliasesshould have a foreign key to the parent tablepersons(i.e. have a columnaliases.personIdwhich referencespeople.personId)Then to retrieve the data use
Joins.references:
Cardinality (data modeling)
Foreign key
Join (SQL)
and lastly and most importantly Normalization