SmootQ
SmootQ

Reputation: 2122

A simple UML case

I have tables: user, comment and post, say:

  1. A user can have many posts and comments
  2. A post can have many comments
  3. A comment can only be written by one user, and can only be in one post

So, how can I make the relations between those tables, in way that results in no closed relation.

this is what I did :

tbl_user 1 ------ n  Post 
tbl_post 1--------n Comments

Upvotes: 0

Views: 97

Answers (1)

Attila
Attila

Reputation: 28762

I think your approach is good, but you should also establish a tbl_user: 1..n Comment relationship (assuming not only the owner of a post can make a comment) to identify the relationship between the comment and its owner.

Upvotes: 2

Related Questions