有什么方法可以获取有关表中特定行的插入时间
的信息?
假设,我有以下表(用户):
________________
| ID | name |
|_____|________|
| 1 | tom |
| 2 | brad |
|_____|________|
现在,我想知道插入第二行(2,brad) 的时间。
这可能吗?任何帮助表示赞赏!
最佳答案
你可以试试这个:
select table_schema,table_name,max_time
from information_schema.tables t1 JOIN
(select MAX(t2.create_time) AS maximum_time FROM
information_schema.tables t2 where
table_schema ='user') as t3
on t1.create_time = t3.max_time;
这将给出表中最后一次插入的时间。
旁注:
您可以在表中再添加一列,并在插入记录时将时间存储在该列中。这将帮助您确定插入特定记录的时间。
像这样:-
insert into yourtable(ID, name, CreatedTime)
values(2,'Brad',now())
关于mysql - MYSQL中一行的插入时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29484111/