Figuring out relationships between tables. - Mailing list pgsql-general

From Andrew Cooper
Subject Figuring out relationships between tables.
Date
Msg-id h6rkp6$ilp$1@aioe.org
Whole thread Raw
Responses Re: Figuring out relationships between tables.
Re: Figuring out relationships between tables.
List pgsql-general
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 by date:

Previous
From: Greg Stark
Date:
Subject: Re: Multiple table entries?
Next
From: Guillaume Lelarge
Date:
Subject: Re: Strange "missing tables" problem