Хорошо, вы можете использовать контрольный журнал, создав триггер для таблицы
пример
при вставке записано
CREATE TRIGGER emp_insert AFTER Insert ON hs_hr_employee FOR EACH ROW BEGIN
INSERT INTO hs_hr_audit (audit_table_name, audit_row_pk, audit_field_name, audit_old_value, audit_new_value,audit_datetime,audit_user,audit_description) VALUES ( "hs_hr_employee", NEW.emp_number, null, null, null,NOW(),@user,"new record added");
END;
для обновления tabel
CREATE TRIGGER emp_update AFTER UPDATE ON hs_hr_employee FOR EACH ROW BEGIN IF NOT( OLD.emp_number <=> NEW.emp_number) THEN INSERT INTO hs_hr_audit (audit_table_name, audit_row_pk, audit_field_name, audit_old_value, audit_new_value,audit_datetime,audit_user,audit_description) VALUES ( "hs_hr_employee", OLD.emp_number, "emp_number", OLD.emp_number, NEW.emp_number,NOW(),@user,"record updated"); END IF;
IF NOT( OLD.employee_id <=> NEW.employee_id) THEN INSERT INTO hs_hr_audit (audit_table_name, audit_row_pk, audit_field_name, audit_old_value, audit_new_value,audit_datetime,audit_user,audit_description) VALUES ( "hs_hr_employee", OLD.emp_number, "employee_id", OLD.employee_id, NEW.employee_id,NOW(),@user,"record updated"); END IF;
IF NOT( OLD.emp_lastname<=> NEW.emp_lastname) THEN INSERT INTO hs_hr_audit (audit_table_name, audit_row_pk, audit_field_name, audit_old_value, audit_new_value,audit_datetime,audit_user,audit_description) VALUES ( "hs_hr_employee", OLD.emp_number, "emp_lastname", OLD.emp_lastname, NEW.emp_lastname,NOW(),@user,"record updated"); END IF;
IF NOT( OLD.emp_firstname <=> NEW.emp_firstname) THEN INSERT INTO hs_hr_audit (audit_table_name, audit_row_pk, audit_field_name, audit_old_value, audit_new_value,audit_datetime,audit_user,audit_description) VALUES ( "hs_hr_employee", OLD.emp_number, "emp_firstname", OLD.emp_firstname, NEW.emp_firstname,NOW(),@user,"record updated"); END IF;
выполните поиск по контрольному журналу в Google для получения более подробной информации