We have seen many queries from users to count the number of tables in a database. So decided to write a small post on it.
You can find the total number of tables in a database with the help of query. Sometimes, there is a huge list of tables in the database and it becomes a nightmare to count them all manually. The query which we are going to share becomes the actual savior during any such requirements stated above.How to count number of tables in database? #sqlserver #mysql #oracle #database Click To Tweet
We have compiled the list of queries which can be used to count the number if tables in database created in SQL Server, MySQL or Oracle.
FOR SQL SERVER
USE DBNAME SELECT COUNT(*) FROM information_schema.tables WHERE table_type = 'base table'
FOR MY SQL
SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'dbName';
USE databasename; SHOW TABLES; SELECT FOUND_ROWS();
-- List of tables SELECT TABLE_NAME FROM DBA_TABLES; --Count of tables SELECT Count(*) FROM DBA_TABLES;
We have listed the query which can be used to count number of tables in database for these popular databases SQL Server, MySQL and Oracle.
Hope you found the post useful and informative.
What do you think?
If you have any questions or suggestions please feel free to email us or put your thoughts as comments below. We would love to hear from you. If you found this post or article useful then please share along with your friends and help them to learn.