
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
MySQL Query to Display 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−
Advertisements