Withdata Software

How to get primary key of a table from DB2

SELECT COLNAME
FROM syscat.COLUMNS
WHERE tabschema='my_schema_name'
AND tabname='my_table_name'
AND KEYSEQ=1

See also:

How to get primary key of a table from PostgreSQL

How to get primary key of a table from SQLite

How to get primary key of a table from MySQL

How to get primary key of a table from SQL Server

How to get primary key of a table from Oracle

Some DB2 tools you can try: https://www.withdata.com/db2/