![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Apply MySQL query to each table in a database?
To apply MySQL query to each table in a database, you can use INFORMATION_SCHEMA.TABLES. Following is the syntax −
SELECT SUM(TABLE_ROWS) AS anyAliasName FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=yourDatabaseName;
Let us implement the above syntax to query each table in a database.
mysql> SELECT SUM(TABLE_ROWS) AS Total FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA= DATABASE();
This will produce the Following output −
+-------+ | Total | +-------+ | 1666 | +-------+ 1 row in set (0.01 sec)
Advertisements