So I am planning to create a dynamic organizational chart, can anyone give me a hint on how can I design my database? Org chart is something like image on the link below. Sorry for my bad drawing skills.
Asked
Active
Viewed 1,212 times
1 Answers
0
Not a lot to go on, but this is how I would start
Seeing as it's possible to build a tree structure from a flat array containing parent-child relationships (see here), I would create a table holding [department][parent department]
and whatever else you wish to store on departments themselves. If it's in only 1 language you can stick the description in there, etc. Department
is key, Parent department
a foreign key on the same table.
If you want it to have positions and people too, I would create separate tables for all of those. One mapping positions to departments, and one mapping people to positions.