+ 1
How i find last updated or deleted record in mysql?
Please provide explanation
2 Answers
+ 3
If your looking for the information when was your table last updated, it can be checked from information schema
https://stackoverflow.com/questions/307438/how-can-i-tell-when-a-mysql-table-was-last-updated
SELECT UPDATE_TIME FROM information_schema.tables WHERE TABLE_SCHEMA = 'dbname' AND TABLE_NAME = 'tabname'
To see the same on the record level, you must accomodate this in your table design, for example it is common to add a column LAST_UPDATED that contains the current timestamp and changes its value automatically on update.
Tracking deletions is much more tricky, you may be able to trace them only in the log files if they are enabled.
https://stackoverflow.com/questions/38093167/how-to-recover-deleted-rows-from-mysql-database
If you need to keep deleted rows, then it may be a better idea to have an ACTIVE_FLAG column and instead of deletion just change this to No.
+ 1
thank you