How to store multiple emails work, personal etc for one contact in MySQL

前端 未结 3 1654
面向向阳花
面向向阳花 2021-01-29 01:33

I need to store multiple email addresses for each user in MySQL and have it normalized. Emails can be for work, personal, etc even multiple work emails or any other can be linke

3条回答
  •  伪装坚强ぢ
    2021-01-29 02:13

    yes, you can also use composite key (using primary or unique index) in the contact_emails table using contact_id and email_type_id. This way one contact will have only one email of a certain type. without the index, a user can save 1+ emails from same email type.

提交回复
热议问题