DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: Data modelling- how do you resolve m:m recursive relationship

  1. #1
    Join Date
    Apr 2002
    Posts
    61

    Question

    Hi,
    I have a recursive relationship with many to many as follows. Employee table. An employee may be supervised by many other employee and an employee may supervise many other employees. How do I implement this business requirement.
    Please give me your ideas.
    Thanks,
    Ramesh

  2. #2
    Join Date
    Oct 2000
    Location
    Germany
    Posts
    1,185
    There is a resolution entity, call it MGR_EMP. It has two columns, MGR_ID and EMP_ID. Both have FKs to the EMP_ID in the EMP table.

    An employee has 0 or many MGR_EMP relations and an employee manages through 0 or many MGR_EMP relations.
    David Knight
    OCP DBA 8i, 9i, 10g

  3. #3
    Join Date
    Sep 2001
    Location
    NJ, USA
    Posts
    1,287
    U should create to tables:

    1 EMP_TABLE
    (
    emp_id number(..) primary key,
    ..
    )

    2. XREF_EMPS
    (
    emp_id number(..),
    emp_xr number(..)
    )

    This is standart decision for recurcive (or graph) relationship (N x M) in 1 table.


  4. #4
    Join Date
    Apr 2002
    Posts
    61
    Thank you both David and Shestakov.

    Ramesh

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width