;

How to get a list of all the table names of a particular database by using a query in MySQL


Tutorialsrack 01/10/2019 MySQL

In this article, we will learn how to how to get a list of all the table names of a particular database by using a query in MySQL.

There are two ways to find all table names present in a specific database by using the following Show tables or metadata tables commands in MySQL:

Using SHOW TABLES or SHOW FULL TABLES

SHOW TABLES statement is used to get a list of all the tables present in the specific database. It returns only table name from a specific database.

Example - By using SHOW TABLES
USE Your_DatabaseName;

SHOW TABLES;

The SHOW TABLES statement allows you to show if a table is a base table or a view. To include the table type in the result, you use the following form of the SHOW TABLES statement.

Example - By using SHOW FULL TABLES
USE Your_DatabaseName;

SHOW FULL TABLES;

By Using INFORMATION_SCHEMA.TABLES

Another way to get all the table name of a specific database by using the system view INFORMATION_SCHEMA.TABLES. This returns one row for each table or view in the specific database.

Example - By using INFORMATION_SCHEMA.TABLES
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = Your_DatabaseName;

I hope this article will help you to understand how to get a list of all the table names of a particular database by using a query in MySQL

Share your valuable feedback, please post your comment at the bottom of this article. Thank you!

 

 

 


Related Posts



Comments

Recent Posts
Tags