(5.6)
mysql test -s -N
set sql_mode='PIPES_AS_CONCAT';
select 'select ''' || table_name || ',''||count(*) from ' || table_name || ';'
from information_schema.tables
where table_schema ='test'
order by table_name
;
(12cR1)
set head off
set pages 0
select 'select ''' || table_name || ',''||count(*) from ' || table_name || ';'
from user_tables
order by table_name
;
(11)
\pset tuples_only 1
\pset format unaligned
select 'select ''' || relname || ',''||count(*) from ' || relname || ';'
from pg_class
where relkind = 'r'
and relnamespace = 'public'::regnamespace
order by relname
;
(2014)
sqlcmd -h -1 -d test
set nocount on
select 'select ''' + name + ',''+cast(count(*) as varchar) from ' + name + ';'
from sys.tables
order by name
;