Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get the creation date of a MySQL table? [duplicate]

I was wondering if it is possible to get the date that a specific table in a database was created. My employer would like to add this feature and I have been unable to find a solution with Google.

I figured SO is the next best place to look.

like image 382
Matt Hintzke Avatar asked Aug 08 '12 16:08

Matt Hintzke


People also ask

How can I tell when a MySQL table was created?

SELECT create_time FROM INFORMATION_SCHEMA. TABLES WHERE table_schema = 'yourDatabaseName' AND table_name = 'yourTableName'; My table name is 'skiplasttenrecords' and database is 'test'.

What is the command to retrieve the current date in MySQL dba?

MySQL CURDATE() Function The CURDATE() function returns the current date. Note: The date is returned as "YYYY-MM-DD" (string) or as YYYYMMDD (numeric).

How can we create a table with same structure without data?

CREATE TABLE new_table AS (SELECT * FROM old_table WHERE 1=2); For example: CREATE TABLE suppliers AS (SELECT * FROM companies WHERE 1=2); This would create a new table called suppliers that included all columns from the companies table, but no data from the companies table.


1 Answers

You would query the information_schema for the create_time of the table.

For instance:

SELECT create_time FROM INFORMATION_SCHEMA.TABLES   WHERE table_schema = 'your_schema'   AND table_name = 'your_table' 

Reference: http://dev.mysql.com/doc/refman/5.0/en/tables-table.html

like image 58
Daniel Li Avatar answered Oct 23 '22 19:10

Daniel Li