简体   繁体   English

创建此数据库的ER图

[英]Creating E-R diagram of this Database

I have created a database with several tables and am trying to back track and create an ER diagram of it, but am struggling with it. 我已经创建了一个包含多个表的数据库,并试图回溯并为其创建ER图,但是却在努力工作。 The database system is to be used to match people with similar preferences. 该数据库系统将用于匹配具有相似偏好的人。

  • Each user has administrative information (stored in user_core), information about themselves (stored in a record in user_profile) and information about their preferences (stored in an EAV user_prefs table). 每个用户都有管理信息(存储在user_core中),有关自己的信息(存储在user_profile中的记录中)以及有关其首选项的信息(存储在EAV user_prefs表中)。
  • The 'preferences' table stores an pref_id for a preference and its name “首选项”表存储首选项的pref_id及其名称
  • The 'shortlist' table stores an id of a user and another id of a user they have shortlisted. “候选名单”表存储一个用户的ID和他们已入围的用户的另一个ID。 Each user will have as many entries in there as they do people shortlisted. 每个用户在其中拥有的条目数量与入围者一样多。
  • The 'groups' table stores information about a group of people. “组”表存储有关一群人的信息。 Each group has an id and the members specify this in their user_core, and a maximum number of people in the group 每个群组都有一个ID,成员在其user_core中指定此ID,并且该群组中的人数上限

Most of the trouble comes from identifying what the entities are - are they just going to be the table names for the most part? 大多数麻烦来自确定实体是什么-它们在大多数情况下是否只是表名?

These are my tables. 这些是我的桌子。 The name at the start is the table name, and the CSVs are the field names: 开头的名称是表名称,而CSV是字段名称:

user_core = {id, birthday, sign_up_date, access token, group ID}

user_profile = {id, gender, course, university, religion}

user_prefs = {id, pref_id, value, weight}

preferences = {pref_id, name}

shortlist = {id, targ_id}

groups = {group_id, max_no}

So if I were going to make an ER diagram out of this how would I do it? 因此,如果我要据此制作ER图,该怎么办?

If I were to split it up I would say the entities in my application are: user, preference, shortlist, group. 如果我将其拆分,我会说应用程序中的实体是:用户,首选项,候选列表,组。 But when I try to think of the relations it starts to get confusing - most likely due to the fact that I am working in reverse here! 但是,当我尝试考虑这种关系时,它开始变得令人困惑-最有可能是由于我在这里相反地工作! Any help or pointers would be appreciated, thanks! 任何帮助或指示,将不胜感激,谢谢!

If you really want an ER diagram, then each entity get one box, and each relationship gets either a line between two boxes or a diamond with lines to the boxes, depending. 如果您真的想要一个ER图,那么每个实体都会得到一个方框,并且每个关系都会得到两个方框之间的一条线,或者是一条带有指向方框的菱形的钻石,具体取决于。

It looks like user-profile is just more attributes of a user, but user-preferences is a relationship between many users and many preferences. 看起来,用户配置文件只是用户的更多属性,但是用户首选项是许多用户和许多首选项之间的关系。

if, instead, you want to make a database schematic diagram, which some people call an ER diagram, then each table gets a box. 相反,如果您要制作一个数据库逻辑示意图,有人将其称为ER图,那么每个表都会有一个方框。

A database schematic is tilted towards a relational implementation, while an ER model is implementation agnostic. 数据库原理图倾向于关系实现,而ER模型则与实现无关。 Also, and ER model reflects analysis, while a database schematic includes design. 而且,ER模型反映了分析,而数据库原理图包括设计。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM