如何在mysql中创建自动更新时间字段?

I have created a post table. I want to have a time field in the table which will auto update in self with the time. Like say if the post is inserted in a row at 1pm and I am checking it after 2hrs it should contain the value 2 or something like that.

At the time of inserting the post it will contain 0 minutes. After 30 minutes if i execute a select query it should contain 30

Is there a way to do that in mysql only?

Hey first you just save your time time in table on inserting time with NOW() sql function and when you run the select query just subtract table insert time from NOW(). it will work.

select NOW() - inserttiontime from table;