SHOW PK

Core command SHOW PRIMARY KEYS SH PK SHPK

Shows the primary keys for a given table name

Arguments

<tableName> (mandatory) a table name, optionally qualified with its schema

Examples

SHOW PK CUSTOMER;

Notes

Lists the primary key columns of a table: SHOW PK <tableName>.

tableName is mandatory and may be schema-qualified (e.g. `SHOW PK PUBLIC.CUSTOMER). Table names are resolved exactly as for DESCR`: schema-qualified or current schema, tried as typed, then upper case, then lower case, and otherwise matched exactly (_ and % are ordinary characters of the name, never wildcards).

Reports that the table has no primary key when it has none. Fails with an error if no table name is given, if the table does not exist or is ambiguous, or if the JDBC driver cannot provide primary key metadata.

Last modified in release 5.3.2.