简体   繁体   English

多用户管理的数据库结构

[英]Database structure for multi user management

I am developing a website which will have multiple user interface admin , client , public , I am creating a single table for these users and am separating them only with the value of one field. 我正在开发一个网站,它将拥有多个用户界面adminclientpublic ,我正在为这些用户创建一个表,并且只使用一个字段的值将它们分开。

USER 用户

------------------------------
id
username
password
level     Values (0=>admin, 1=>client, 2=>public)

Is is appropriate to develop a table structure in such manner, or should I create different table for different level of user. 是否适合以这种方式开发表结构,或者我应该为不同级别的用户创建不同的表。

I would recommend that you create a separate table for user levels. 我建议您为用户级别创建一个单独的表。 This will allow for a user to level relationship and allow for seamless and efficient updates. 这将允许用户建立关系并允许无缝和有效的更新。

user
----
id
username
password
level_id (fk)

userLevel
----
id
level

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM