So I am busy learning databases for an rpg I have been thinking of to learn more specialized techniques with game development itself. Now I am trying to draw a conceptual data model to get things solid and clear for me to work with, but I can't quite understand the relationships between two entities. Take for example this image: Model

How does this work, I understand the rectangles are entities and therefore become tables in a SQL database but how can those relationships have attributes? Do they become their own tables or is the fk in Account a multivalue with all Character Names?

I can't quite grasp it yet I understand how databases work on a basic level. It just needs to click so any help or explanation will be appreciated.


Green rectangles are tables, red eclipses are attributes, blue triangles are tables that connect tables and a relationship descriptors so you could understand their relationship. Do not name triangle like tables as referred on the diagram, such as 'contains' , give them meaningful names.

Purple eclipses are additional attributes of tables that connect other tables

Numbers and letters next to triangles are telling you what kind of relationship it is

Whether is :

One to many - example Table Account has 1 and table Character has N which means one account can have many characters , but character can have only 1 account

Many to many - example Character can "Ran into" many creeps and many creeps can ran into many characters

What does it means?

It means that depending on a relationship type, you will create foreign keys and constrains accordingly. If you are still in doubt what the foreign keys are, i suggest you to read some books/articles before you actually start designing database. Databases are base for any project, and it is not something to be taken lightly

  • Thanks alot this got me on the right track! So if I understand correctly the relationtable of account and character the charactername is the PK because in the has table there can only be one character and account name is the FK because multiple of the same account can be listed but with differenct character names – unbekn0wn Jul 5 '17 at 9:15
  • 1
    Nitpicking: the blue are not triangles. They are rhombuses (or rhombi). – ypercubeᵀᴹ Jul 5 '17 at 9:18
  • So table with notation "HAS" would have its own ID (ever increasing number preferably), with a foreign keys referenced by table Account and table Character – S4V1N Jul 5 '17 at 9:25
  • You are right! ever since Phil left Knicks all i see are triangles, my bad – S4V1N Jul 5 '17 at 9:26

To expand slightly on S4V1N's answer:

In a one to many relationship, one would normally use the primary key from the "one" table as a foreign key in the "many" table, linking each "many" record back to its specific "one" record.

In your case, I would expect that the character table would have AcctName as a foreign key, referencing Account.AcctName.

Usually, you only need some additional table linking things together in a many-to-many relationship.

Not the answer you're looking for? Browse other questions tagged or ask your own question.