I am creating an audit table for tracking changes done on a record in main table.
Here audit table is the exact duplicate of main table (say Employee Table) but will only have ‘inserts’ for every changes happens in the main table. So it will have duplicates (same EmployeeIDs), so should I add separate Audit_ID for each entry?
Sure you need some kind of a primary key in the table.
It will be easier to remove duplicates and to track the ‘reason of insert’ (for debugging purposes) if you have one.
Some
RDBMS‘s (likeMySQLwithInnoDB) actually create a hidden primary key for you if you didn’t do it explicitly, so just do it yourself and make if visible and usable.