tblPerson
PersonID
LastName
FirstName
tblCompany
CompanyID
CompanyName
tblCompany_Employee
PersonID
CompanyID
StartDate
EndDate
tblCompany_Employee. , , . EndDate UPDATEd NULL empoyments.
, SELECT PersonID FROM tblCompanyEmployee WHERE EndDAte IS Null.
:
SELECT PersonID
FROM tblCompany_Employee
WHERE PersonID = @PersonID
AND CompanyID = @CompanyID
AND EndDate IS Null
. , , , true EmployeeID.
, , false.
In this case, the audit trail is saved, and it is possible (with some refinement, obviously - I'm pretty rude here) to determine:
and. Employment history for a person in all companies B. All persons employed by a particular company C. Who currently works for a particular company D. Who currently does not work for a specific company D. Etc.
No data loss due to UPDATES that overwrite the historical record.
source
share