社交网站数据库方案设计
您好,我正计划设计一个社交网站(如 orkut)asp.net mvc。我陷入了数据库设计困境。任何人都可以为我提供该网站的资源。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这些是初始数据库设计应遵循的步骤。
首先,列出所有要存储的“对象”,例如用户、帖子、关系等。
其次,找出您想要存储其中每一个的信息(用户名、密码、全名、地址……)。
然后按照第三范式设计数据库表。
数据库设计应该始终以第三范式完成,如果存在性能问题并且您了解恢复的后果,则恢复为其他形式。通常,您可以通过正确应用计算字段或触发器来安全(高效)地完成此操作。
例如,您不应该做的一件事是尝试在用户表中建立关系模型。该表中的一行将以用户名作为键,并且关系取决于两个用户名,因此这将违反规则 3。
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.
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.
Barry Williams 拥有一个免费数据模型库,他将其作为各种应用程序的起点。他的作品集包括一个社交网站的建议模型;该页面还包含一些支持信息的链接。 了解更多信息。
Barry Williams hosts a library of free data models, which he offers as starting points for all sorts of applications. His portfolio includes a suggested model for a social networking site; that page also includes links to some supporting information. Find out more.
您可以弄清楚字段/查询和其他所有内容,但基本表非常简单:
存储用户的登录/密码/访问信息
存储用户可能输入的任何附加数据(全名、生日等)
之间的关系
根据您的用户将发布的媒体类型,这给出了所有发布的消息的列表,并附加了用户 ID
这是它的基础,这个布局可能足以模拟 Twitter(这是一个非常简单的)地点)。
任何额外的事情你可能应该用你的大脑来弄清楚。这真的没那么难。 Facebook 并不是因为创建良好的数据库模式而流行的。
You can figure out the fields/queries and everything else, but the basic tables are very simple:
Stores the User's Login/Password/Access Information
Stores the any additional data that the user might enter (Full Name, Birthday, etc)
Stores the relationships between user A and User B
Depending on what type of media your users will be posting in, this gives a list of all the messages posted, with a User ID attached
That is the basis of it and this layout is probably sufficent enough to mock Twitter (which is a very simple site).
Anything additional you should probably use your brain to figure out. It really isn't that hard. Facebook didn't become popular for creating a good database schema.
用户模块将有两个主表,即
tblUser(userId(P key)
,其他详细信息列)tblContacts(UserId(F key from tbluser),ContactId(F key from tbluser)< /code> 和
userid
和contactid
都是主键,即复合键)There will be two main tables for user module i.e.
tblUser(userId(P key)
, other detail columns)tblContacts(UserId(F key from tbluser),ContactId(F key from tbluser)
and bothuserid
andcontactid
will be primary key, ie. composite key)