In mysql, you can use the SELECT statement with the count() function to query the number of tables in the database. The syntax is "SELECT count() FROM information_schema.TABLES WHERE TABLE_SCHEMA='database name';".
The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer.
View the number of database tables
The syntax is as follows:
SELECT count(TABLE_NAME) FROM information_schema.TABLES WHERE TABLE_SCHEMA='dbname';
where dbname is the name of the database to be viewed.
View the table structure:
description tbname;
You can also use the abbreviation:
desc tbname;
The example is as follows:
select count(*) tables ,table_schema from information_schema.tables where table_schema='work_ad' group by table_schema;
Recommended learning:mysql video tutorial
The above is the detailed content of How to query the number of tables in mysql. For more information, please follow other related articles on the PHP Chinese website!