Show PrimaryKeys

The show primarykeys command displays all the primary keys in the specified table.

Syntax

SHOW PRIMARYKEYS FROM schemaName.tableName

schemaName

The schema name.

tableName

The table name.

Results

The show primary keys command results contains the following columns:

Column Name Description
TABLE_NAME The name of the table
COLUMN_NAME The name of the column
KEY_SEQ The order of the column within the primary key
PK_NAME The unique name of the constraint

Examples

splice> create table myTable(i int, j int, primary key (i,j));
0 rows inserted/updated/deleted

splice> show primarykeys from mySchema.myTable;
TABLE_NAME  |COLUMN_NAME  |KEY_SEQ  |PK_NAME
-------------------------------------------------------
A           |I            |1        |SQL141120202723310
A           |J            |2        |SQL141120202723310

2 rows selected