DESCRIBE
Describe the specified table.
Syntax
DESCRIBE [<database_name>.]<table_name>;
Remarks
<table_name>
is the name of a table in a database.<database_name>
is the name of a database. Not needed if the table exists in the current database.This command can be run on any node (see Node Requirements for SingleStoreDB Commands ).
key
has three possible values, primary (PRI), unique (UNI), and multiple (MUL).PRI: A primary key can be one or more columns, but cannot be null.
UNI: A unique key is similar to a primary but it can have null values.
MUL: A multiple key is neither a primary or unique key. It can have a null value and multiple occurrences of the same value.
Warning
When setting a unique or primary key you need to have a shard key. Otherwise you will receive an error.
Examples
DESCRIBE test; **** +-------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------+-------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | v | varchar(10) | NO | | NULL | | +-------+-------------+------+-----+---------+----------------+
DESCRIBE memsql_demo.customer; **** +------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------+---------------+------+-----+---------+-------+ | custkey | int(11) | NO | PRI | NULL | | | name | varchar(25) | NO | | NULL | | | address | varchar(40) | NO | | NULL | | | nationkey | int(11) | NO | MUL | NULL | | | phone | char(15) | NO | | NULL | | | acctbal | decimal(15,2) | NO | | NULL | | | mktsegment | char(10) | NO | | NULL | | | comment | varchar(117) | NO | | NULL | | | zip2 | binary(5) | YES | | NULL | | | balance | double | YES | | NULL | | +------------+---------------+------+-----+---------+-------+