用户,客户,管理员帐户在3个不同的表? [英] User, customer, admin account in 3 different tables?
问题描述
在我的网络应用程序中,我将有三种类型的帐户。
- 用户:
- 客户:用于广告和获取公司徽标
- 管理员:用于编辑和删除内容
如果这三个都在单独的表中,或者在一个名为account_type的列,我可以标记为用户,客户或管理员?
<两者的优点和缺点是什么?是否有最佳做法?
感谢
一般,人
可以是用户,客户和管理员 - 所以,我将从一个人
IsCustomer
, IsUser
, IsAdmin
。稍后(快速搜索),您可以决定添加单独的表 Admin
,客户
, $
编辑:
典型案例可能是:
- 500万用户
- 1000个客户
- 10个管理员
加快任何管理员/客户相关查询。
In my web application I will have three types of accounts.
- User: for using the web application for free
- Customer: for advertising and getting a Company Logo
- Admin: for editing and deleting stuff
Should all these three be in separate tables or in one with a column named "account_type" where i can mark it as User, Customer or Admin?
What are the pros and cons for both? Is there a best practice for this?
Thanks
In general, a person
can be user, customer and admin -- so, I would start with a Person
table with columns IsCustomer
, IsUser
, IsAdmin
. Later (for fast search) you may decide to add separate tables Admin
, Customers
, Users
with FK to the Person
table.
EDIT:
A typical case may be:
- 5 million users
- 1000 customers
- 10 admins
In general, having separate tables for customers and admins should speed-up any admin/customer related query.
这篇关于用户,客户,管理员帐户在3个不同的表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!