I have IBM DB2 database. I would like to get all column names, types length and scale grouped by table names.
To get all tables from schema XYZ:
select name
from SYSIBM.SYSTABLES
where creator = 'XYZ';
Now I can get colum descriptions for given table:
SELECT NAME, COLTYPE, LENGTH, SCALE
FROM SYSIBM.SYSCOLUMNS
WHERE TBNAME = 'sometablename'
I would like to group it:
SELECT NAME, COLTYPE, LENGTH, SCALE
FROM SYSIBM.SYSCOLUMNS
WHERE TBNAME in (select name from SYSIBM.systables where creator = 'XYZ')
GROUP BY table_names_from_schema_xyz;
How to do it?