Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to know the date of insertion of record in SQL

I am using phpMyAdmin for my project and I have a table without date/datetime field.

I am wondering if there's a way to know when I inserted each record on the database

like image 224
ihssan Avatar asked Nov 19 '25 14:11

ihssan


1 Answers

While designing your database if you forgot to keep an extra field to store the insertion time of a row then you have only one option left to know the the insertion time.

But the condition is you must have binary logging enabled prior to it.

Reference

You may check if binary logging is enabled in your part by executing this query :

SHOW VARIABLES LIKE 'log_bin';

Further Note:

And from now on you may keep an extra field which will track the insertion time of each row.

Change your table design :

Add an extra field in your table with datatype "timestamp/datetime" with default value CURRENT_TIMESTAMP and on update CURRENT_TIMESTAMP.

like image 118
1000111 Avatar answered Nov 21 '25 07:11

1000111