- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How do I get the creation date of a MySQL table?
To get the creation date of MySQL table, use the information_schema. The syntax is as follows −
SELECT create_time FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = 'yourDatabaseName’ AND table_name = 'yourTableName';
Apply the above syntax for your database and the table name. Here I am using the database ‘business’ and table name is ‘student’. The query is as follows −
mysql> SELECT create_time FROM INFORMATION_SCHEMA.TABLES -> WHERE table_schema = 'business' -> AND table_name = 'student';
The following is the output displaying the creation time of a table −
+---------------------+ | CREATE_TIME | +---------------------+ | 2018-10-01 12:26:57 | +---------------------+ 1 row in set (0.12 sec)
Let us see another example and create a table from scratch.
mysql> create table DateAsStringDemo -> ( -> YourDateTime datetime -> ); Query OK, 0 rows affected (0.57 sec)
I have just created a table and my current date time is as follows −
mysql> select now();
The following is the output −
+---------------------+ | now() | +---------------------+ | 2018-11-26 18:12:29 | +---------------------+ 1 row in set (0.00 sec)
Now you can check the creation time of the above table, which will give the date 2018-11-26.
The query is as follows −
mysql> SELECT create_time FROM INFORMATION_SCHEMA.TABLES -> WHERE table_schema = 'test' -> AND table_name = 'DateAsStringDemo';
The following is the output −
+---------------------+ | CREATE_TIME | +---------------------+ | 2018-11-26 18:01:44 | +---------------------+ 1 row in set (0.00 sec)
- Related Articles
- How to get the creation date of a MySQL table?
- How can I the date of creation and updation of tables in MySQL?
- How to get the creation time of recently created table in MySQL?
- How do you get a directory listing sorted by creation date in Python?
- How do I get the current AUTO_INCREMENT value for a table in MySQL?
- How do I get the current date in JavaScript?
- How do I clone the structure of a table in MySQL?
- How to get creation and modification date/time of a file using Python?
- How to get file creation & modification date/times in Python?
- How do I show the schema of a table in a MySQL database?
- How do I alter a MySQL table column defaults?
- How do I get the current time zone of MySQL?
- How do I show unique constraints of a table in MySQL?
- How do I get the current date and time in JavaScript?
- How do I list all the columns in a MySQL table?

Advertisements