如何组织不同类型内容的表 [英] How to organize tables for different type content

查看:88
本文介绍了如何组织不同类型内容的表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个网站。我计划为用户添加许多功能,并且每个用户需要许多字段来存储数据。我的问题是我不知道是否应该将所有用户活动存储在一个表中(问题,答案,投票,个人数据......)或制作单独的表(一个用于问题,一个用于答案......)。我希望以后可以添加/修改列。

I am developing a website. I plan to add many features for users and that requires many fields for each user to store data. My problem is I don’t know if I should store all user activities in one table (questions, answers, votes, personal data ... ) or make separate tables (one for questions , one for answers ...). I would like to be able add/modify columns later.

推荐答案

您好b $ b

亲爱的欧内斯特你应该研究数据库规范化获得有关您的问题的答案。一个非常好的数据库在3NF应该是正常的,但是有时候我们需要一个BCNF,但是更多次3NF规范化对于使用数据库来说是非常好的规范化。你可以阅读关于lins的标准化的说明:



http:// en .wikipedia.org / wiki / Database_normalization [ ^ ]

http://support.microsoft.com/kb/283878 [ ^ ]

http://databases.about.com/od/specificproducts/a/normalization.htm [ ^ ]

https://www.ischool.utexas.edu/~wyllys/DMPAMaterials/normstep.html [ ^ ]



最好的问候。
Hi
Dear Ernest you should study about Database Normalization for get the answer about your question. a really good database should be normal at 3NF however some times we need a BCNF but more times 3NF normalization is really good normalization for working with database. you can read about normalization follow of lins:

http://en.wikipedia.org/wiki/Database_normalization[^]
http://support.microsoft.com/kb/283878[^]
http://databases.about.com/od/specificproducts/a/normalization.htm[^]
https://www.ischool.utexas.edu/~wyllys/DMPAMaterials/normstep.html[^]

Best Regards.


It真的取决于你的具体需求。如果我是你,我会试着弄清楚将来会有什么变化(新领域,新关系......)。如果所有数据都在一个表中,我会期望很多空字段。不要忘记优化数据库以获得更快的搜索查询。另外不要忘记数据库会随着时间的推移而增长。考虑所有这些因素并设计满足上述所有要求的数据库,你就错了。
It really depends on your specific needs. If I were you I would try to figure out what will be changed in the future ( new fields, new relations ...). I would expect a lot of empty fields if all data are in one table. Don’t forget to optimize database for faster search queries. Also don’t forget that database will grow over time. Take all of those factors and design database that will meet all of the requirements mentioned above and you can be wrong.


这篇关于如何组织不同类型内容的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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