数据库设计,在同一个表的多个类型的客户 [英] Database design, multiple types of customers in the same table

查看:386
本文介绍了数据库设计,在同一个表的多个类型的客户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

业务场景:


  • 客户可以登录到一个在线电子商务应用,使用他们的电子邮件地址作为其登录信息。

  • Customers can login to an online e-Commerce app, using their e-mail addresses as their logins.

我们有一个CRM应用程序,取决于在同一数据库上。员工使用CRM应用程序添加非网上客户,以及电子邮件,不需要现场在这里。

We have a CRM app that depends on the same database. Employees use the CRM app to add non-online customers, and e-mail is NOT required field here.

从技术上讲:
没有什么自然地使得客户表中的PK。无论如何,我总是用人工PK即使没有自然的。我很担心,这最终将导致搜索,诚信等问题,我不能确定的问题上来了什么,虽然。

Technically: There is nothing "naturally" making a PK in Customer table. Regardless, I always use an artificial PK even if there is no natural one. I'm worried that this will eventually lead to problems in searching, integrity, etc. I can't determine exactly what problems will come up, though.

我觉得开发商不会想到电子邮件列允许空,他们将创造无视这种状况的方案。

I think developers won't expect the e-mail column to allow null, and they will create programs ignoring this situation.

记住,整个系统,而大多数的数据库将取决于客户数据,如果事情customer表出现问题,它可能会被其他表继承。

Remember that the whole system, and most of the database will depend on customer data, if something goes wrong in the customer table, it will probably be inherited by the other tables.

两种类型的在我的脑子客户火灾例外的存在,但我不能找出异常的消息。你怎么看?它是更好地找到一些出路了吗?或者你认为,这是确定,离开它这样,直到出了问题,因为它是不容易引起问题,请记住,这个问题是不是由neccissary一个bug,它可以维护或开发并发症?

感谢

推荐答案

有没有一个具体的理由在同一个表将这些数据一起?做CRM的客户和电子商务的客户在这个数据库有许多其他表?

Is there a specific reason to put these data together in the same table? Do CRM "customers" and e-commerce customers share many other tables in this database?

老实说,我不会把电子商务客户在这个数据库中。虽然你可以创建视图,很容易区分电子商务和CRM数据,这似乎完全没有必要给我。此外,你还没有描述的任何特别的原因电子商务和CRM数据需要住在同一个数据库中。也许有你没有的问题包括有原因的,但是这已经闻,如果你问我。

Honestly, I would not put e-commerce customers in this database. Although you can create views to easily separate e-commerce and CRM data, this seems totally unnecessary to me. Furthermore, you haven't described any particular reason why e-commerce and CRM data need to live in the same database. Maybe there's a reason you didn't include in the question, but this already smells if you ask me.

这是你在这里包含的信息,我不认为你失去任何通过创建电子商务客户一个单独的数据库和表显著。保持不相关的数据是分开的。

From the information you've included here, I don't think you're losing anything significant by creating a separate database and table for the e-commerce customers. Keep unrelated data separate.

编辑:

为了让这个额外的清楚:如果你的电子商务客户的不共享很多与CRM客户数据,创建新的客户表。如果他们的做占有率大量的数据,再一个空列可能是世界不是结束。

To make this extra clear: if your e-commerce customers do not share a lot of data with the CRM customers, create new customer tables. If they do share a lot of data, then one null column is likely not the end of the world.

这篇关于数据库设计,在同一个表的多个类型的客户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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