
386 views
MySQL Show Tables
To display a list of tables in a MySQL database, you can use the SHOW TABLES statement. Here’s the basic syntax:
SHOW TABLES;
This statement will return a list of all the tables in the currently selected database. To use it:
- Make sure you’ve already selected the database you want to work with using the
USEstatement:
USE database_name;
Replace database_name with the name of the database you want to select.
- After selecting the database, you can then execute the
SHOW TABLESstatement to list the tables in that database:
SHOW TABLES;
The result of this query will be a list of table names from the selected database.
Please note that you should have appropriate privileges to access and list the tables in the database. Users with the SHOW privilege can execute the SHOW TABLES statement to view the table names.