mysql - 我应该规范化这个(用户)表吗?

标签 mysql database database-normalization

这用于工作门户中的用户数据。

Wright 现在我在一个 users 表中有这个列:

user_id
email
password
registred_date
online (user online ? 1 : 0)
last_visit
activation (activation hash for not activated users, 1 for activated)
firstname
lastname
nickname
age
location
range (from location)
telephone
skype
qualifications (IDs from qualifications table, ie: "1,4,5,21,46,52")
education
desired_salary
desired_hourly_rate
hourly_rate_fixed (hourly_rate can be fixed ? 1 : 0)
user_image

基本上除了password, activation, user_id 之外的所有列都是为了显示。

你认为这个表应该归一化吗?

我当时想的是把它分成 2 个表。

一种形式的账户识别/授权/系统:

user_id
email
password
registred_date
online (user online ? 1 : 0)
last_visit
activation (activation hash for not activated users, 1 for activated)

其次是用户个人/个人资料数据:

user_id
firstname
lastname
nickname
age
location
range (from location)
telephone
skype
qualifications (IDs from qualifications table, ie: "1,4,5,21,46,52")
education
desired_salary
desired_hourly_rate
hourly_rate_fixed (hourly_rate can be fixed ? 1 : 0)
user_image

最佳答案

如果您应该规范化,这是您的决定。 以下是一些事实: 1.规范化的数据库/表需要更少的空间,但由于空间非常便宜,所以没关系。顺便说一句,如果你标准化你的数据库并且你看起来不像一个菜鸟,那就更好了。 2.在规范化数据库中搜索速度较慢,因为您必须进行连接等。

所以最后由您决定,但我会正常化它。

关于mysql - 我应该规范化这个(用户)表吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34698259/

相关文章:

MySQL:如何计算过滤数据集上的行数(在不同条件下)?

Mysql SUM 和 group by 不起作用

javascript - Firebase:访问空/不存在的键及其子项

MySQL 规范化或非规范化

database - 在用户表中存储用户属性

php - mysql php从2个表中选择具有相同字段名称的字段

mysql - 我的 phpMyAdmin 版本丢失了 'test' 按钮

mysql多个where和where not in

database - Informix "Invalid Argument"连接字符串异常

php - 有没有正确的方法来处理类里面的数据库连接?