How to query the number of tables in mysql

WBOY
Release: 2022-05-16 15:58:34
Original
8644 people have browsed it

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';
Copy after login

where dbname is the name of the database to be viewed.

View the table structure:

description tbname;
Copy after login

You can also use the abbreviation:

desc tbname;
Copy after login

The example is as follows:

select count(*) tables ,table_schema from information_schema.tables where table_schema='work_ad' group by table_schema;
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!