I have created an employee table as

Emp_ID(Primary key), Emp_Name, Address,Designation,Manager_ID(Foreign Key).

Foreign key is mapped with the primary key. In manager id column I am entering the id of his/her manager. It means there will be many employee with same manager id. Now the problem I am facing is it creates conflict between the employee id and manager id.

How will I maintain the database.

1 Answers

Md.Bahar Uddin On

You can try with the following insert query

INSERT INTO employee(Emp_ID, Emp_Name, Address,Designation,Manager_ID) values(1,"xyz","ABC","Engineer",(select manager_id from manager where id = 1))