in Databases
184 views
1 vote
1 vote

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

in Databases
184 views

1 Answer

1 vote
1 vote

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. 

2 Comments

means two attributes are required in friend relation .?
0
0

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.

0
0