How could I get the count of rows from each table in a certain DB including the tables name? I know how to get the table count and the sum of rows for all tables, but not how to get the count for each table separately.
3 Answers
If all the tables are inside a single database, let's assume it to be "test123", then you can use the following command to fetch number of rows:
SHOW TABLE STATUS
FROM `test123`;
It'll return result containing the following values:
`Name`, `Engine`, `Version`,
`Row_format`, `Rows`, `Avg_row_length`,
`Data_length`, `Max_data_length`, `Index_length`,
`Data_free`, `Auto_increment`, `Create_time`,
`Update_time`, `Check_time`, `Collation`,
`Checksum`, `Create_options`, `Comment`