Ok, here is the breakdown of my problem. I have two table:
Employees and Taken_Treatments. Here is the list of columns for each table:
Employee Table:
- Empolyee ID - Primary Key
- Employee Name - Name
- Employee Surname - Surname
Taken_Treatments:
- Treatment ID - Primary Key
- Personnel ID - Foreign key refers to Employee ID
- Individula - Foreign key refers to Patient ID
- Type of treatment - Foreign key refers to Treatment ID
I have 5 employees and 7 treatments.
Now here is the problems: I fired an employee thus I have to delete his entry from the employee table. I have dealt with the foreign key contraint and thats where the problem begins: I have three choices:
- set a default value (ID of a different Employee)
- set values as null
- cascading: deleting every row where is the employee refered to
For the employee table, it is not a good practice to have hired and fired employee in the same table. Moreover, on Taken_treatments table, I cannot have null values for an employee and I dont want neither update the table with another employee ID nor deleting a Taken_Treatment entry with the fired doctor.
So, I want to do this: Instead of deleting the employee permanently, I would like to put him to another table (lets say Former employees) so Taken_Treatment entries stays intact (something like archiving), is something like that possible? -Thank you-