184 views

Recursive relation require new table ?or not when we converting ER to relation?please explain

Suppose an instance of this relationship in database where,

UID - $102$ has $2$ Friends $\{103 \ 104 \}$

Now if you try to map this instance to single table maintaining the integrity which looks like this :

 User.UID User.Name Friend.Uid(Foreign key) 102 a ??

You can`t map anything because there will be redundancy and database will not allow that rather :

 user.UID user.Name 102 a 103 b 104 c
 friend.UID1 friend.UID2 102 103 102 104

Allowed and accepted and can be identified by combining both of these column.

means two attributes are required in friend relation .?

Relationships either recursive or non recursive are always meant for two entities or tables if you could do it with one attribute then its not a relationship anymore.

1
195 views