Home  >  Article  >  Database  >  How to query the number of tables in mysql

How to query the number of tables in mysql

WBOY
WBOYOriginal
2022-05-16 15:58:348649browse

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';".

How to query the number of tables in mysql

The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer.

How to query the number of tables in mysql

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;

How to query the number of tables in mysql

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn