Model a Zero or One to Many Relationship

Posted by John on Stack Overflow See other posts from Stack Overflow or by John
Published on 2010-03-27T17:27:23Z Indexed on 2010/03/27 17:33 UTC
Read the original article Hit count: 248

How should I model a zero or one to a many relationship in the database? For example, a user record may or may not have a parent. So should my user table have a t_user.parent_id or should I have an associative table called t_user_hierarchy with the columns t_user_hierarchy.parent_id and t_user_hierarchy.user_id?

© Stack Overflow or respective owner

Related posts about data-modeling

Related posts about database-design