Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DESCRIBE TABLE equivalent in CockroachDB?

Tags:

cockroachdb

I tried using Oracle's DESCRIBE TABLE... statement in CockroachDB and got a syntax error. What’s the equivalent command?

like image 664
Alex Robinson Avatar asked Apr 10 '17 18:04

Alex Robinson


People also ask

What is the use of describe table?

Describes either the columns in a table or the current values, as well as the default values, for the stage properties for a table. DESCRIBE can be abbreviated to DESC.

What type of database is CockroachDB?

CockroachDB is a distributed SQL database built on a transactional and strongly-consistent key-value store.


1 Answers

In CockroachDB, the SHOW COLUMNS statement returns information about the columns in a table, similar to the DESCRIBE statement in MySQL and the \d command in PostgreSQL:

SHOW COLUMNS FROM tablename;

You can also get some information by running SHOW INDEX or SHOW CREATE TABLE or by querying the information_schema database.

like image 150
Alex Robinson Avatar answered Oct 06 '22 10:10

Alex Robinson