Thanks a lot K245!! That is a trick worth knowing and it saves a lot of headaches.
I agree that with this method, the "not null" constraint must be removed, it was set to work with my workaround, but if you remove a manager from someone at some point, you get an error because of the "not null" constraint.
In this case, it is necessary to add a check before deleting an entry: if the entry being deleted is referenced as a manager, then report this and not allow deletion.
There may be several options: 1) do not delete; 2) reset the link in dependent records to NULL; 3) delete along with dependent records. In your case, the first or second option will be suitable.
In real systems, records are rarely deleted unless they were entered to test the system. Typically, flags are used to indicate that the entry is being archived and should not be displayed in normal cases.
But your case is even more interesting. I would add a separate table - managers, which would link to the employees table. In this case, when dismissing or changing a manager, you do not need to edit all the employees who linked to him, but rather make one edit in the manager table, linking it with another person or with a special record, where instead of the first and last name it will be written “Position vacant”
Визуальное программирование: блог