社交网站数据库方案设计

发布于 2024-08-26 05:25:06 字数 72 浏览 5 评论 0原文

您好,我正计划设计一个社交网站(如 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

不知所踪 2024-09-02 05:25:06

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

首先,列出所有要存储的“对象”,例如用户、帖子、关系等。

其次,找出您想要存储其中每一个的信息(用户名、密码、全名、地址……)。

然后按照第三范式设计数据库表。

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

数据库设计应该始终以第三范式完成,如果存在性能问题并且您了解恢复的后果,则恢复为其他形式。通常,您可以通过正确应用计算字段或触发器来安全(高效)地完成此操作。

例如,您不应该做的一件事是尝试在用户表中建立关系模型。该表中的一行将以用户名作为键,并且关系取决于两个用户名,因此这将违反规则 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.

  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.

肩上的翅膀 2024-09-02 05:25:06

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.

絕版丫頭 2024-09-02 05:25:06

您可以弄清楚字段/查询和其他所有内容,但基本表非常简单:

  • 用户表
    存储用户的登录/密码/访问信息
  • 用户信息表
    存储用户可能输入的任何附加数据(全名、生日等)
  • 关系表
    之间的关系
  • 存储用户A和用户B的帖子表
    根据您的用户将发布的媒体类型,这给出了所有发布的消息的列表,并附加了用户 ID

这是它的基础,这个布局可能足以模拟 Twitter(这是一个非常简单的)地点)。

任何额外的事情你可能应该用你的大脑来弄清楚。这真的没那么难。 Facebook 并不是因为创建良好的数据库模式而流行的。

You can figure out the fields/queries and everything else, but the basic tables are very simple:

  • User Table
    Stores the User's Login/Password/Access Information
  • User Info Table
    Stores the any additional data that the user might enter (Full Name, Birthday, etc)
  • Relationship Table
    Stores the relationships between user A and User B
  • Post Table
    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.

谁把谁当真 2024-09-02 05:25:06

用户模块将有两个主表,即

  1. tblUser(userId(P key),其他详细信息列)
  2. tblContacts(UserId(F key from tbluser),ContactId(F key from tbluser)< /code> 和 useridcontactid 都是主键,即复合键)

There will be two main tables for user module i.e.

  1. tblUser(userId(P key), other detail columns)
  2. tblContacts(UserId(F key from tbluser),ContactId(F key from tbluser) and both userid and contactid will be primary key, ie. composite key)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文