Why are recursive relationships are bad? How do you resolve them?

Showing Answers 1 - 3 of 3 Answers

John

  • Jun 24th, 2005
 

Recursive relationships are an interesting and more complex concept than the relationships you have seen in the previous chapters, such as a one-to-one, one-to-many, and many-to-many. A recursive relationship occurs when there is a relationship between an entity and itself. For example, a one-to-many recursive relationship occurs when an employee is the manager of other employeess. The employee entity is related to itself, and there is a one-to-many relationship between one employee (the manager) and many other employees (the people who report to the manager). Because of the more complex nature of these relationships, we will need slightly more complex methods of mapping them to a schema and displaying them in a stylesheet.

ritwik roy

  • Jul 21st, 2005
 

using the concept of self join may be a solution to this problem. e.g if a table called employees contains three fields like emp_id,name and manager_id and we will have to find out the name of the manager for each employee, then we can use the following code 
select a.name,b.name 
from employees a, employees b 
where a.manager_id=b.emp_id 

  Was this answer useful?  Yes

Jeetendra Nalawade

  • Nov 12th, 2007
 

We have used a different way of maintaning recursive relationship. We have created a ancestry table which will give the childs for each entry upto n th level. This way you can fire queries directly to get the child upto any specific level.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions