On this page
SHOW PK
Core command
SHOW PRIMARY KEYS
SH PK
SHPK
Shows the primary key columns of a table.
Syntax
SHOW PK [<schema>.]<table>
Arguments
| Argument | Required | Values | Default |
|---|---|---|---|
<table> | Yes | The exact table name, in any case | None |
<schema>. | No | The schema of the table, followed by a dot | The current schema |
Examples
SHOW PK CUSTOMER;
SHOW PK PUBLIC.CUSTOMER;
Details
The table is found exactly as for DESCR: in the given schema or the current one, tried as typed, then in upper case, then in lower case, and otherwise matched exactly (_ and % are ordinary characters of the name, never wildcards).
A table without a primary key is reported as such. The command fails when no table name is given, when the table does not exist or is ambiguous, or when the JDBC driver cannot provide primary key metadata.
Related
- DESCR, how the table name is found
- SHOW FK
- SHOW INDEXES
Used in these how-tos
Last modified in release 5.5.0.
Found something wrong or unclear on this page? Tell us, with the page address.