I would like to know how many rows are in each table in my database. I’ve come so far as to having
select count(*) _tablename_;
However i would need to do that on each and every table – and there are a lot. What would me the best way to get a print-out with the table name and it’s row count?
Advertisement
Answer
SELECT table_name, table_rows FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = '<your db>';
I also hope you realise there’s an error in your query: it’s missing a FROM
.