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

  • Home
  • SEARCH
  • 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 6144969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:43:38+00:00 2026-05-23T18:43:38+00:00

In my program, I need to make an organization chart starting with individuals and

  • 0

In my program, I need to make an organization chart starting with individuals and grouping them under a manager, then group those managers under senior managers etc… How do I do this with regards to the database?? This is a many to one relationship – which I thought was illegal and impossible – and would be like starting with the child table – individuals – before creating its parent – manager.
If someone can help point me in the right direction to design my database I’d really appreciate it!!

—-EDIT—-
Here’s a more detailed explanation of my problem:

Let’s say a user of my program starts by entering in 35 individuals they’d like to use on some project they’re going to work on. Now, there are several possible management positions that can be created and have employees/other (lower) managers assigned to those. The user doesn’t HAVE TO create any particular position, but can pick and choose and assign however they like. The only constraints are there will always be a top manager – let’s call him the President – and that he SHOULD (but doesn’t HAVE TO) only assign 5-10 people to any given manager (president included). So in this example we are starting with 35 individuals and a President. Now we start grouping the 35 individuals into teams and assigning one of them as manager. Say the user decides to have two teams of 6, two teams of 9, and one team of 5 – each of these groups has one of its individual members assigned as manager of that team. So now we have 5 teams, each under its own manager, and those five managers would now be assigned to the President. The program would let this go but warn the user that the number of individuals under a manager in the last team is less than 5 (is only 4). So the user can now (or at ANYtime) go back and change the organization. So let’s say he wants to fix this issue and changes up the teams. So he breaks up one of the two teams of 9 and assigns one individual to the team that was short a person. This makes a final count of 3 teams of 6 (5 individual members and one manager), one team of 9 (8 ind and 1 mngr), and one team of 8 (7 ind and 1 mngr) and all 5 team managers are assigned to the president.

Only in real life this can get broken down much further – nests with many more levels of management. How can I do this?

Is Joe Hopfgartner’s answer below still valid? Can I just make a “role” column, even though the role would be assigned later (after the row is initially created)? Or changed at any time? Can this self-referencing foreign key be null? (as it would be in the case that no manager has been assigned yet) Or should I move the individuals to a separate “team” table after they’ve been assigned to a team and move the managers to a “manager” table once they’ve been assigned as a manager, then add a foreign key for the team table referencing the manager table?

Also, I am using MySQL, so does that fact that you cannot use self-referential ON UPDATE CASCADE or ON UPDATE SET NULL operations affect my particular case (since users will no doubt often be changing the assignments)?

Thank you so much for helping me with this!!!

  • 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-05-23T18:43:39+00:00Added an answer on May 23, 2026 at 6:43 pm

    if one individual can only have one manager, just introduce a “parent person” id field or put managers in a seperate table.

    if not, create another table for a relation like “person_has_manager” that assigns a person to a manager.

    you can also put managers and persons into the same table and introduce a “role” field, but this can be tricky when using foreign key constraints if you want to ensure that only manages can have persons assigned to them.

    to solve this problem you can introduce a “person_is_manager” table that links person to their job as manager, and persons can be linked to be managed by that manager. this ould look like this:

    persons
    -> person_id (primary)
    -> name
    -> etc
    
    managers
    -> person_id (primary, linked to person_id in persons)
    
    person_has_manager
    -> person_id (primary)
    -> manager_id (primary, linked to person_id in managers table)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to be able to make a program that looks through a mailbox
I'm trying to make a setup program for an ASP.NET web site. I need
I have a program that I need to run under *nix and windows. because
I need to make a program with a limited amount of threads (currently using
I need to make a small test program in java which has to communicate
i need to make a cron job to run a java program every 40
I need to make a simple refresh button for a gui java program I
In my program, I need to make use of an ElementTree object in various
If so are the changes I would need to make to an existing program
I'm trying to write a program that modifies fractions and I need to make

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.