Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Is it possible to display number of rows for every table in a given database with a single command?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Use the information_schema:

select table_schema database, table_name, table_rows rowcount
       from information_schema.tables 
where table_schema = 'DATABASE_TO_LOOK_UP'
and engine = 'MYISAM';

Afaik only for MyISAM-tables an exact rowcount is stored in the information_schema tables. If you use the SQL above for INNODB-tables, the rowcount displayed will be an approximation.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.