0

I'm a beginner at MySQL. I have a table with 160rows . I need to keep tracking this table everytime someone make change to all row , example

tabelname = customer
id 
user_id
name 
lastname
datebirth
accupation
spouse
etc...
etc..

until 160 rows in total

When someone changes a record, let say datebirth, I need all detail record in the history table. When someone changes 10times, I need all the records to change, so I have 10 save records on history tables.

sagara76
  • 1
  • 4

1 Answers1

1

You can maintain another table for history. Whenever any update happen in base table you just need to copy current row to history table and you can additionally maintain user_id (user who updated row) and timestamp (time when update occurred). This way you can fetch the history of the row with group by operation on customer_id, time etc.

For Implementation you can follow this approach - https://dev.to/zhiyueyi/design-a-table-to-keep-historical-changes-in-database-10fn

for more info - 1-> SQL history table design 2-> how to have a history of the Sql table column.? 3-> How to store historical records in a history table in SQL Server

kumudgupta76
  • 354
  • 3
  • 10