B
B
beckmiller2019-08-05 15:15:52
MySQL
beckmiller, 2019-08-05 15:15:52

How to create a table about employees?

I have a database task:

----------------------------------------------
Сотрудник                       Отдел
Иванов                            Бухгалтерия (начальник)
Темиров                          Продавец
Рабиев                             Бухгалтер
----------------------------------------------

Such conditions:
1. There can be only one head in one department.
2. There is no department without a leader.
3. An employee can be hired or fired.
4. The transfer of an employee from department to department is a hire-fire.
5. If there is one employee in the department, then he is the boss.
How to correctly implement a database? Ie how to make a bunch?
I have such data will be correct?
employee: departmentID
manager: employeeID, departmentID
departmaent: id, names,
managerID

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
EVGENY T., 2019-08-05
@Beshere

Emploee(id, name)
Department(id, name)
DepReestr(deprtment_id, emploee_id, position, beg-date, end-date)
I think it’s not right to bother with the bosses separately, but if it’s really necessary, then:
Department(id, name, manager_id)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question