To view all tables in a MySQL database, you can use the SHOW TABLES; command, which will display a list of all tables, including table name, type, and number of rows (if INFORMATION_SCHEMA is enabled).
How to view all tables in the database in MySQL
To view all tables in the MySQL database, you can use Following command:
<code>SHOW TABLES;</code>
After executing this command in the command line, it will display the list of all tables in that database.
Detailed explanation:
SHOW TABLES
command is a MySQL built-in command used to display all tables in the current database. It will return a result set with the following information:
INFORMATION_SCHEMA
is enabled) Example:
Suppose you have a database named my_database
which contains two tables table1
and table2
. To view these tables, you can run the following command:
<code>SHOW TABLES FROM my_database;</code>
This will produce the following output:
<code>+----------------------+ | Tables_in_my_database | +----------------------+ | table1 | | table2 | +----------------------+</code>
This output shows that there are table1## in database
my_database # and
table2 are two tables.
The above is the detailed content of How to view all tables in the database in mysql. For more information, please follow other related articles on the PHP Chinese website!