Is there a query that will show the last created table in a database?
In the Object Explorer in SQL Server Management Studio, go to the database and expand it. Under the Tables folder select the table name. Right click and select Properties from the menu. You will see the created date of the table in the General section under Description.
To select the last row, we can use ORDER BY clause with desc (descending) property and Limit 1. Let us first create a table and insert some records with the help of insert command. The query is as follows. After creating the above table, we will insert records with the help of insert command.
The easiest way to find all tables in SQL is to query the INFORMATION_SCHEMA views. You do this by specifying the information schema, then the “tables” view. Here's an example. SELECT table_name, table_schema, table_type FROM information_schema.
SELECT UPDATE_TIME FROM information_schema. tables WHERE TABLE_SCHEMA = 'yourDatabaseName' AND TABLE_NAME = 'yourTableName'; Let us implement the following query to get the last updated time. mysql> SELECT UPDATE_TIME -> FROM information_schema.
Across all databases within your MySQL instance:
SELECT *
FROM information_schema.TABLES
ORDER BY CREATE_TIME DESC
LIMIT 1
For the specific database you're connected to:
SELECT *
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = SCHEMA()
ORDER BY CREATE_TIME DESC
LIMIT 1
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