您可以使用触发器并将更改存储在另一个表中。
从我的头顶开始(以下假定productId永远不会更新);
create table main (
`id` int not null auto_increment,
`title` varchar(30) not null,
`price` float not null,
primary key(`id`)
);
create table logger (
`id` int not null auto_increment,
`productId` int not null,
`from_title` varchar(30) not null,
`to_title` varchar(30) not null,
`from_price` float not null,
`to_price` float not null,
primary key(`id`)
);
delimiter //
create trigger my_logger before update on main
begin
insert into
logger
set
`productId`=OLD.`id`,
`from_title`=OLD.`title`,
`to_title`=NEW.`title`,
`from_price`=OLD.`price`,
`to_price`=NEW.`title`;
end;//
delimiter ;