Row versioning in MySQL

喜夏-厌秋 提交于 2019-11-29 23:25:17

问题


I would like to include an integer version field in my table, auto-incrementing on each update made to a row. Is it possible to do this in MySQL?

Please note that I'm not talking about a TIMESTAMP, which is not reliable as two concurrent updates might happen during the same second.


回答1:


The only way (I can think of) to do this is a (before-update) trigger that automatically increments the column value.




回答2:


Yes it is. The more general problem is called slowly changing dimensions.



来源:https://stackoverflow.com/questions/6290695/row-versioning-in-mysql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!