Counting the tables in MySQL Database

Finding ou how cool MySQL is, I gathered this statement that might be useful when doing a CLI tasks.

select count(*) as number_of_tables from information_schema.tables WHERE table_schema='schema_name';

OR

select count(*) as number_of_tables from information_schema.tables WHERE table_schema='schema_name' and table_type = 'BASE TABLE';


The latter one does only selects those base tables, BASE TABLE is actually a MySQL valid value of a table_type. This link can give some information about schema -> http://dev.mysql.com/doc/refman/5.0/en/information-schema.html

Comments

Popular posts from this blog

LVM: How to remove a volume using pvremove

Use Shell Editor for Eclipse for editing bash, ksh, csh in Unix/Linux system

pdftotext not found in CentOS