basic database design table on rails

Posted by runcode on Stack Overflow See other posts from Stack Overflow or by runcode
Published on 2012-10-02T03:25:43Z Indexed on 2012/10/02 3:37 UTC
Read the original article Hit count: 164

I am confuse on a concept. I am doing this on rails.

Is that Entity set equal to a table in the database?

Is that Relationship set equal to a table in the database?

Let say we have Entity set "USER" and Entity set "POST" and Entity set "COMMENT"

User- can post many posts and comments as they want
Post- belong to users
Comments-belong to posts ,users, so comment is weak entity.

SCHEMA
======
USER
-id
-name
POST
-id
-user_id(FK)
-comment_id (FK)
COMMENT
-id
-user_id (FK)
-post_id (FK)

so USER,POST,COMMENT are tables I think.

And what else is a table? And do I need a table for the relationship??

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about database