How to find the number of tables present in the databases?
Answers
Answered by
0
In many ANSI-compliant database systems, you can use catalog table INFORMATION_SCHEMA.TABLES to see list of tables and count them.
This applies to at least following: Oracle, Microsoft, PostgreSQL, MySQL.
Exact numer of tables may surprise you since this can include system tables. You may filter by schema to fix it.
Example (public is default schema in PostgreSQL):
SELECT count(*) AS totalTables
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'public';
This applies to at least following: Oracle, Microsoft, PostgreSQL, MySQL.
Exact numer of tables may surprise you since this can include system tables. You may filter by schema to fix it.
Example (public is default schema in PostgreSQL):
SELECT count(*) AS totalTables
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'public';
Similar questions