How can you tell if a table in DB2 has a Primary Key?
Disclaimer: I do not know DB2.
I simply googled these with "db2 table definition".
Source:
SELECT *
FROM SYSIBM.SYSTABLES TAB,SYSIBM.SYSCOLUMNS COL
WHERE TAB.CREATOR = COL.TBCREATOR
AND TAB.CREATOR = 'xxxx'
AND TAB.NAME = 'xxxxxxxxxxxxx'
AND TAB.NAME = COL.TBNAME
AND TAB.TYPE = 'V' ( OR 'T' )
ORDER BY 1,2;
Source:
SELECT * FROM syscat.tabconst WHERE type = 'P';
you can do a db2look
, which will give you the ddls for the table.
db2look -d db_name -e -x -z schema_name -t table_name