Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8421063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:02:21+00:00 2026-06-10T03:02:21+00:00

I want to create the given company structure in the database for an application

  • 0

enter image description here

I want to create the given company structure in the database for an application and want to traverse the employee details based on the structure. The problem in given below.

When a employee login into the system, he should be able to see the employee’s details who are working under his level. Say for example if “Executive B” login into the system, he should be able to see the details of the staff A, staff B, staff C and staff C’s sub staffs.

At the same time, Staff C is reporting to Section Head C where the Section head C only can view Staff C’s details, not his sub staffs. That means, when Section Head C login, he can view his sub employees and well as Staff C.

But Section Head D can view staff C’s details and his sub staffs details as he have the full access to the branch starts with Staff C. That means he can view his sub employees and also staff C and his sub employees.

Can any one help me to implement this structure and the access levels in the database and how to query them in the efficient way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T03:02:23+00:00Added an answer on June 10, 2026 at 3:02 am

    A common approach to solving this kind of hierarchy traversal problem is to use a technique called visitation numbers, which I describe in detail in my answer to this question. Using visitation numbers, you can easily find the list of all nodes that are below any given node anywhere in the hierarchy.

    Note that you would still record each employee’s direct reporting superior using an involuted foreign key on the employee table.

    For your case, you also have dotted-line reporting (Staff C to Section Head C) outside of the regular reporting hierarchy. This means that you will need two approaches. The first is to use visitation numbers for regular reporting, where managers can see all of their direct and indirect reports, and then something else for dotted-line reporting.

    It seems like you have two kinds of rules for dotted line reporting. Some dotted line supervisors can see sub-staff and others can only see their dotted line direct-reports. Since people can have more than one dotted line supervisor, you need to add an intersection table to record these dotted line relationships. This intersection table can also include a flag attribute that indicates whether or not the dotted line supervisor is able to see the only the immediate dotted line subordinate or that person and all of their subordinates as well.

    Either way, the dotted line relationships are recorded directly between an employee and their supervisor and the regular reporting relationships (which may be indirect) are managed by visitation numbers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create two equal timestamps for a given day in PHP and
1) If we want to create an instance of a given type during runtime
I'm working in PHP and I want to create a function that, given a
I want to use this for an object factory: Given a string, create a
I want create wordpress website into which I want create user management... That means
I want create an application with animate button? how can i do? after click
I work for a company that develops a very large scale data based application.
I want to create a search feature for people and company using the linkedin
i am developing an application for a real-estate company. the problem i am facing
I want to create a color from a given string. The string does not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.