MySQL Forums
Forum List  »  Stored Procedures

Re: Count Table rows using Stored Procedure
Posted by: Peter Brawley
Date: February 08, 2018 01:11PM

> 1- Read a list of tables (e.g. 10)

If it's all the tables of a schema, or if table names follow a string pattern, simplest to use information_schema eg...

select table_name, table_rows
from information_schema.tables
where table_schema='my_schema' and table_name like 'my_%';

Otherwise you could use a comma-separated string of table names with an IN() clause in the above query.

By "print" the result you mean send it to the printer, or display it? If the former, you need to SELECT the result in MySQL, then use the printing capabilities of the OS where your mysql client is running. If the latter, just SELECT it.

Edited 1 time(s). Last edit at 02/09/2018 10:50AM by Peter Brawley.

Options: ReplyQuote

Written By
Re: Count Table rows using Stored Procedure
February 08, 2018 01:11PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.