The sqltool
\d command approximates a "describe", and primary key information is stored under the INFORMATION_SCHEMA
:
sql> CREATE SCHEMA STACKOVERFLOW;
sql> SET SCHEMA STACKOVERFLOW;
sql> CREATE TABLE SO2406470 (pk1 INT NOT NULL, pk2 INT NOT NULL, data VARCHAR(64), PRIMARY KEY(pk1, pk2));
sql> \d SO2406470
name datatype width no-nulls
---- -------- ----- --------
PK1 INTEGER 11 *
PK2 INTEGER 11 *
DATA VARCHAR 64
sql> SELECT * FROM INFORMATION_SCHEMA.SYSTEM_PRIMARYKEYS WHERE TABLE_SCHEM = CURRENT_SCHEMA AND TABLE_NAME = 'SO2406470';
TABLE_CAT TABLE_SCHEM TABLE_NAME COLUMN_NAME KEY_SEQ PK_NAME
--------- ------------- ---------- ----------- ------- ------------
PUBLIC STACKOVERFLOW SO2406470 PK1 1 SYS_PK_10040
PUBLIC STACKOVERFLOW SO2406470 PK2 2 SYS_PK_10040
Fetched 2 rows
(hsqldb-2.0.0rc9)