如何在MySQL中存储一个联系人的多个电子邮件工作,个人等 [英] How to store multiple emails work, personal etc for one contact in MySQL

查看:155
本文介绍了如何在MySQL中存储一个联系人的多个电子邮件工作,个人等的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要为MySQL中的每个用户存储多个电子邮件地址并使其正常化。电子邮件可以是工作,个人等,甚至多个工作电子邮件或任何其他可以链接到一个联系人。



我的想法是有3个表,一个存储类型的电子邮件,另一个用于存储联系人信息名称地址等,第三个用于存储电子邮件/联系人联系人,名为contact_email地址,其中包含来自email_types和联系人表的pk

简单图可以在这里看到 https://bubbl.us/?h=a7f3b/13e72f/ 68J / 1dgjeYVbs
这是否高效?这样一个联系人可以将任何数量的电子邮件地址存储并保存在联系人表中



谢谢

解决方案

是的,你的设计很好。它代表一个常见的,归一化的电子邮件地址数据模型。


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 linked to one contact.

My idea is to have 3 tables, one to store the types of emails, another to store contact info name address etc, and a third to store email/contact associations called contact_email addresses which has pk's from email_types and contacts table

A simple diagram can be seen here https://bubbl.us/?h=a7f3b/13e72f/68J/1dgjeYVbs Is this at all efficient? This way one contact can have as any number of email addresses stored and kept out of the contacts table

Thanks

解决方案

Yep, your design is fine. It represents a common, normalized email address data model.

这篇关于如何在MySQL中存储一个联系人的多个电子邮件工作,个人等的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆