

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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
Total number of fields in all tables in database?
To get total number of fields in all tables in database, you can use information_schema.columns along with aggregate function count(*).
We are using ‘sample’ database which consists of a lot of tables with fields. Following is the query to get total number of fields in all tables in database:
mysql> SELECT COUNT(*) AS TOTAL_NUMBER_OF_FIELDS -> FROM INFORMATION_SCHEMA.COLUMNS -> WHERE TABLE_SCHEMA = 'sample';
This will produce the following output
+------------------------+ | TOTAL_NUMBER_OF_FIELDS | +------------------------+ | 796 | +------------------------+ 1 row in set (0.04 sec)
Now, let us check another database ‘test’. Following is the query to get total number of fields in all tables in database:
mysql> SELECT COUNT(*) AS TOTAL_NUMBER_OF_FIELDS -> FROM INFORMATION_SCHEMA.COLUMNS -> WHERE TABLE_SCHEMA= 'test';
This will produce the following output
+------------------------+ | TOTAL_NUMBER_OF_FIELDS | +------------------------+ | 1108 | +------------------------+ 1 row in set (0.03 sec)
- Related Questions & Answers
- Limit total number of results across tables in MySQL?
- Finding total number of rows of tables across multiple databases in MySQL?
- Get record count for all tables in MySQL database?
- List down all the Tables in a MySQL Database
- Can we get total number of rows in a MySQL database?
- How to count the number of tables in a MySQL database?
- How can I freeze all tables in SAP HANA database?
- Find a specific column in all the tables in a database?
- Display all tables inside a MySQL database using Java?
- How to count the total number of tables in a page in Selenium with python?
- Unloading tables in SAP HANA database
- How can I display all databases in MySQL and for each database show all tables?
- What is the MySQL query to display the number of tables in a database?
- How can we check the character set of all the tables in a particular MySQL database?
- Get number of fields in MySQL table?
Advertisements