Consider a system where employee record is kept. The database should store employee name,department etc. Every employee has a reporting manager to whom he has to report. There are 4 levels of employee –
Every junior engineer has to report to Senior engineer. Every senior Developer has to report to team lead. Every team lead has to report to senior team lead.
I came to this idea:-
There will be two table
1.Employee
2.Reporting
Employee table
would contain necessary information like EmployeeID,Employee Name,Department Name etc.; primary key is EmployeeID
Reporting Table
would contain two columns EmployeeID and ReportingMangerID ;EmployeeID
is foreign key related to Primarykey of Employee Table.
I dont know if I am correct.
If the following is true:
Then you can have "manager" as an attribute for the employee table.
If the following is true:
Then you need to have your structure.