Get the App
SLTechnology News&Howtos  ›  Database  › 

How does mysql query how many tables there are in the database

Shulou Source: shulou.com Published: 2022-05-31 11:11:23 09月14日 Update

This article mainly introduces the relevant knowledge of "mysql how to query the database how many tables", the editor shows you the operation process through the actual case, the operation method is simple, fast and practical. I hope this article "mysql how to query the database how many tables" can help you solve the problem.

In mysql, you can query "information_schema.TABLES" information through the "SELECT" statement, get the metadata information of the data tables in the specified database, and use the "COUNT (*)" function to count the number of metadata to calculate the number of tables in the database.

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

In mysql, you can use the "SELECT" statement to query "information_schema.TABLES" information to calculate the number of tables in the database.

Syntax:

SELECT COUNT (*) TABLES, table_schema FROM information_schema.TABLES WHERE table_schema = 'dbname' GROUP BY table_schema

Example:

SELECT COUNT (*) TABLES, table_schema FROM information_schema.TABLES WHERE table_schema = 'bwlbis' GROUP BY table_schema

Description:

The tables in the information_schema database are read-only and cannot be updated, deleted, inserted, or triggered, because they are really just a view, not a basic table, and there are no associated files.

Information_schema.tables stores the metadata information of the data table. The commonly used fields are described below:

Table_schema: record database name

Table_name: record data table name

Engine: storage engine

Table_rows: rough row estimates for tables

Data_length: size of the record table (in bytes)

Index_length: the size of the index that records the table

Row_format: you can check whether the data table has been compressed

This is the end of the introduction to "how many tables are there in the database by mysql". Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Tags: Data database query information data table knowledge number middle table can be passed size actual industry record table statement storage update different practical rough content Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Shulou Technology Huawei vpn Apple