How can I have a column in a table which records the time which a certain value from another specific column, in the same table, was changed. I am using MySQL version 5.0.67.
This SQL is required for a booking system. For example, when a booking is inserted into the booking table, a confirmation column is filled with: B, when a client confirms a booking the value is changed to BC. How can I record the time which this change took place?
A very common approach is to use “audit” tables which are copies of original tables but with additional columns such as log_id, log_timestamp, log_user. Then you’d create INSERT/UPDATE/DELETE triggers on original tables which will insert copy of changed row into the audit table along with timestamp/db user information.
Here is one example of such implementation: Using MySQL Triggers to Audit Field Changes from a Database Table