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.
SELECT create_time FROM INFORMATION_SCHEMA. TABLES WHERE table_schema = 'yourDatabaseName' AND table_name = 'yourTableName'; My table name is 'skiplasttenrecords' and database is 'test'.
MySQL CURDATE() Function The CURDATE() function returns the current date. Note: The date is returned as "YYYY-MM-DD" (string) or as YYYYMMDD (numeric).
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With