
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
What is the MySQL query to display the number of tables in a database?
Let’s say, here I am using the WEB database. We need to find the number of tables in the database WEB. For this, use the INFORMATION_SCHEMA.TABLES in MySQL.
Following is the query to display the number of tables −
mysql> select count(table_name) as TotalNumberOfTablesInWebDatabase -> from information_schema.tables -> where table_schema='web';
This will produce the following output −
+----------------------------------+ | TotalNumberOfTablesInWebDatabase | +----------------------------------+ | 1562 | +----------------------------------+ 1 row in set (0.27 sec)
To just check whether the count of records displayed above are the same or not, use the SHOW TABLES command. This command would display all the records with the count at the end as shown below−
- Related Articles
- How to count the number of tables in a MySQL database?
- Display all tables inside a MySQL database using Java?
- How to get the size of the tables of a MySQL database?
- List down all the Tables in a MySQL Database
- How to get the list of tables in default MySQL database?
- How to check table status of the tables in a particular MySQL database?
- MySQL query to display ASC order in number column?
- How to display all the MySQL tables in one line?
- Query MySQL database to echo highest auto incremented number?
- MySQL Query to find tables modified in the last hour?
- While connecting to one MySQL database, how can I see the list of tables of other MySQL database?
- How to display all the tables in MySQL with a storage engine?
- How Can I check the size of the tables in a particular MySQL database?
- A single query to get the sum of count from different tables in MySQL?
- Which tables are used to control the privileges of MySQL database server?

Advertisements