Get Count of Tables From MySQL Database

  • Avinash
  • 2
  • Dec 11, 2011
  • Database

Now a days I have work for one application in which I have to create and drop tables dynamically and based on these new tables I have to perform such actions.

So I have to count the numbers of available tables frequently have to perform further tasks in application.

For counting the tables I have found below query which give the number of tables exists in the selected database.

SELECT count(*) as 'Tables', table_schema as 'Database' FROM information_schema.TABLES WHERE table_schema= "database_name" GROUP BY table_schema
  SELECT count(*) as 'Tables', table_schema as 'Database'
  FROM information_schema.TABLES
  WHERE table_schema= "database_name"
  GROUP BY table_schema

You just need to change the database_name with your database name and its done.

Share this if you find this helpful.

Related Posts

Written by Avinash

Avinash Zala is leading various projects which deals with the various technology involved with the web. A combination of perfect technical and management skills. Avinash would like to chat with you and convert your imagination into the working system. You can get in touch with him on Facebook and Twitter.

View all posts by: