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

前端 未结 3 1655
面向向阳花
面向向阳花 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 01:50

    That's how I'd do it. I think your design is fine.

    0 讨论(0)
  • Yep, your design is fine. It represents a common, normalized email address data model.

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题