- 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
Get table names using SELECT statement in MySQL?
To get table names using SELECT statement, use “information_schema.tables”. Let us see an example, wherein we have a database that contains 3 tables. The syntax to get all table names with the help of SELECT statement.
SELECT Table_name as TablesName from information_schema.tables where table_schema = 'yourDatabaseName';
Using database “test”, and applying the above syntax to get the table names using SELECT
mysql> use test; Database changed mysql> SELECT Table_name as TablesName from information_schema.tables where table_schema = 'test';
Output with the name of the three tables.
+--------------------+ | TablesName | +--------------------+ | destination | | myisamtoinnodbdemo | | originaltable | +--------------------+ 3 rows in set (0.00 sec)
- Related Articles
- Get table column names in alphabetical order in MySQL?
- Select Statement to retrieve the same first names with similar last name (but different case) using MySQL?
- MySQL case statement inside a select statement?
- How to create a temporary MySQL table in a SELECT statement without a separate CREATE TABLE?
- MySQL Quoted table/field names vs unquoted names?
- How to call a stored procedure using select statement in MySQL?
- Explain the use of SELECT DISTINCT statement in MySQL using Python?
- Select column names containing a string in MySQL?
- How to can I get the names of my MySQL table columns?
- How to get all table names from a database using JDBC?
- Lower case column names with MySQL SELECT?
- IF() function in a MySQL Select statement?
- Check if table exist without using “select from” in MySQL?
- Select rows from a MySQL table and display using IN()
- What is the syntax in MySQL to get the column names of a table?

Advertisements