Figuring out relationships between tables.

Поиск
Список
Период
Сортировка
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

В списке pgsql-general по дате отправления:

Предыдущее
От: Greg Stark
Дата:
Сообщение: Re: Multiple table entries?
Следующее
От: Guillaume Lelarge
Дата:
Сообщение: Re: Strange "missing tables" problem