SELECT
concat('select ','''',table_name,''' table_name,','count(*) cn from ',table_name,' union all ') myquery
FROM
information_schema.tables
WHERE
table_type = 'BASE TABLE'
and table_schema=database();
SELECT
concat('select ','''',table_name,''' table_name,','count(*) cn from ',table_name,' union all ') myquery
FROM
information_schema.tables
WHERE
table_type = 'BASE TABLE'
and table_schema=database();