Search Postgresql Archives

Figuring out relationships between tables.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Greetings,

This is a general database design question. I've got a database where I need to hold information on employees. Every employee has much of the same information so I've created an Employee table. Now, some employees are supervisors or managers. An employee can only have 1 manager/supervisor but the hierarchy can be varying depths. For example...

I have the following employees:

Bob, Jill, Tom, Bill, Harry, Jane, Amy, Jim, Fred, Sue and June

The management hierarchy works like this:

             Bob
        /      |    \
    Jill      Tom   Bill
    /  \       |      \
Harry  Jane   Amy     Jim
  |                    |
 Fred                 Sue
  |
 June

How can I create these relationships in the database? I don't want a Manager table that duplicates all the information for employees for the managers. Besides, a manager can have a manager who can have a manager... and so on. There is probably a simple solution to this problem but I'm not seeing it. Any help would be appreciated.

Thanks,

Andrew

--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux