zOs/SQL/CATTBIX
with a as
(
select count(all uniqueRule) cIx,
max(case when uniqueRule = 'C' then uniqueRule else ' ' end)
|| max(case when uniqueRule = 'D' then uniqueRule else ' ' end)
|| max(case when uniqueRule = 'G' then uniqueRule else ' ' end)
|| max(case when uniqueRule = 'P' then uniqueRule else ' ' end)
|| max(case when uniqueRule = 'U' then uniqueRule else ' ' end)
|| max(case when uniqueRule = 'R' then uniqueRule else ' ' end)
|| max(case when uniqueRule = 'X' then uniqueRule else ' ' end) u,
max(case when uniqueRule in ('C','D','G','P','U','R','X')
then '' else UniqueRule end) other
from sysibm.sysTables t
left Join sysibm.sysIndexes i
on i.tbCreator = t.creator and i.tbName = t.name
where t.type = 'T'
group by t.creator, t.name
)
select count(*) tbs, sum(cIx) ixs, u, other
from a
group by u, other
order by 1 desc
with ur
;;;
with a as
(
select count(all uniqueRule) cIx, t.dbName
from sysibm.sysTables t
left Join sysibm.sysIndexes i
on i.tbCreator = t.creator and i.tbName = t.name
where t.type = 'T'
group by t.creator, t.name, t.dbName
)
select count(*), dbName
from a where cIx = 0
group by dbName
order by 1 desc
;;;