简体   繁体   中英

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. 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).
  • The 'preferences' table stores an pref_id for a preference and its name
  • The 'shortlist' table stores an id of a user and another id of a user they have shortlisted. 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

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:

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?

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.

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.

A database schematic is tilted towards a relational implementation, while an ER model is implementation agnostic. Also, and ER model reflects analysis, while a database schematic includes design.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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