+ 1

How i find last updated or deleted record in mysql?

Please provide explanation

4th Jul 2019, 7:48 PM
Gaurav Shinde
Gaurav Shinde - avatar
2 Réponses
+ 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.
5th Jul 2019, 4:19 AM
Tibor Santa
Tibor Santa - avatar
+ 1
thank you
9th Jul 2019, 4:53 AM
Gaurav Shinde
Gaurav Shinde - avatar