数据库方案设计社交网站 [英] Database scheme design social networking sites

查看:118
本文介绍了数据库方案设计社交网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打算设计一个社交网站(如orkut)asp.net mvc.我被困在数据库设计中。有人为我提供了一个资源。

解决方案

这些是您应该遵循的初始数据库设计步骤。



首先,列出所有对象你想要存储,比如用户,帖子,关系等等。



其次,找出每个这些信息,你们都有哪些信息想要存储(用户名,密码,全名,地址,...)。



然后按照第三种正常格式设计数据库表。


  1. 表中的每列都应该是该键的一个属性。

  2. 表中的每列都应该是属性

  3. 表格中的每一列都应该只是 的一个属性。

数据库设计应始终以第三种正常格式完成,如果有性能问题可以理解回归的后果。您通常可以通过计算字段或触发器的正确​​应用来安全(有效地)执行此操作。



作为示例,您应该不要两个用户名,这样就违反了规则3。


Hi I am planning to design a social networking site (like orkut) asp.net mvc.I am stuck in database design.Anyone provide me the resource for that one.

解决方案

These are the steps you should follow for initial database design.

First, list down all the "objects" you want to store, such as users, posts, relationships and so on.

Second, figure out, for each of those, what information you want to store (user name, password, full name, address, ...).

Then design your database tables following the third normal form.

  1. Every column in a table should be an attribute of the key.
  2. Every column in a table should be an attribute of the entire key.
  3. Every column in a table should be an attribute of only the key.

Database design should always be done in third normal form, reverting to other forms if there is a performance problem and you understand the ramifications of reversion. You can generally do this safely (and efficiently) with the proper application of computed fields or triggers.

As an example, one thing you should not do is to try and model relationships in the users table. A row in that table will have the user name as the key and a relationship depends on two user names, so that would violate rule 3.

这篇关于数据库方案设计社交网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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