# Miscellaneous > General Database Discussions >  Having trouble with an ERD relationship between an EMPLOYEE, MANAGER, & DEPARTARTMENT

## chadsxe

Hi,

Let me start by saying I am new to database design. I have been programming for 5 years now but recently felt like it would be of worth to learn about databases and database design. I picked up a few books and am now working my way through them. So without further ado, hear is my first question. 

I am currently trying to understand and learn how to use the Entity Relationship Model. One of the books I am reading asks me to conceptualize a basic ERD showing the relationships between a Department, Employee, and Manager. The book offered me up these business rules.

Each department has many employees, but each employee belongs to one department. 

Each department is managed by one employee, and each of those managers can manage only one department. 



So what I am confused about is if a manager is an employee how do I represent that relatiomship.

Regards

Chad

----------


## brad jones

Yes, I'm bumping a 7 year old thread. It wasn't, however, answered, and I'm curious as to how people would answer this....

Brad!

----------


## casinc815

> Hi,
> 
> Let me start by saying I am new to database design. I have been programming for 5 years now but recently felt like it would be of worth to learn about databases and database design. I picked up a few books and am now working my way through them. So without further ado, hear is my first question. 
> 
> I am currently trying to understand and learn how to use the Entity Relationship Model. One of the books I am reading asks me to conceptualize a basic ERD showing the relationships between a Department, Employee, and Manager. The book offered me up these business rules.
> 
> Each department has many employees, but each employee belongs to one department. 
> 
> Each department is managed by one employee, and each of those managers can manage only one department. 
> ...



Chad

The answer is the relationship between manager and employee is recursive.  There should be only two entities in the overall ERD diagram:  Department and Manager/Employee.
Think of the data requirement and use a spreadsheet to demonstrate the data; column A is Department,  Column B is Manager and Column C is employee.  BE sure to make 
Manager and Employee equal number when you assigning a Manager to the department.  He/She is an employee of the department. 

Now start with department One and Ad 10 one's to the first column. In column two add 10 one's in column two depicting only one manager.  In the third column add number
1 thru 10 starting with cell C1 on the spreadsheet.  That is what recursive does for programming. 

The end result should show one that in Department One, the first Manager has 9 employees plus himself.

If you want to add a second manager, add 10 one's to the first column.  This means the same department.  Add the number two to the second column, this is the second manager.
Add 1-10 in the thirs column and note you have demonstrated two Manager's in One department.

Good luck!

Jim (casinc815)

----------


## casinc815

the answer to the question is the ERD should be a recursive relationship.  There should only be two entities; Department and Manager/Employee(call the second entity what you may).  Recursive nature of the table is the manager is also an employee and has employees reporting to Him/Her.  I would be happy to demonstrate the data on a spreadsheet if you like.  Simply reply to this thread and I will jump back on.

Good luck!

Jim(casinc815)

----------

