On this page
DESCR
Describes the columns of a table: name, type, size, nullability and default value.
Syntax
DESCR [<schema>.]<table> [ALPHA]
Quick start
DESCR CUSTOMER;
Lists the columns of CUSTOMER, in table order.
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 |
ALPHA | No | Sorts the columns by name, ignoring case | Table order |
Examples
DESCR CUSTOMER;
DESC CUSTOMER ALPHA;
DESCR PUBLIC.CUSTOMER;
Details
Columns shown
Each column's name, type, size, nullability and default value. Size is the declared length for character and binary columns, and precision,scale for DECIMAL and NUMERIC columns (for example 10,2); for other types it is the size the JDBC driver reports.
By default the columns are in table order, their position as the database reports it. With ALPHA, the same columns, with the same information, are sorted by name, ignoring case, for a quicker lookup in a wide table; only the order of the rows changes.
How the table name is found
SHOW PK, SHOW FK, SHOW REFERENCES and SHOW INDEXES find the table exactly the same way.
- Without a schema, only the connection's current schema is searched; a table with the same name in another schema is not shown. Qualify the name (
DESCR OTHERSCHEMA.TOTO) to describe a table of another schema. - The name is tried as typed, then in upper case, then in lower case, and the first variant that names an existing table is used. When it is not the one you typed, the console says which table was found.
- There is no wildcard or partial name:
_and%are ordinary characters of the name.DESCR FOO_BARnever describesFOOXBAR, andDESCR TRYnever describesCOUNTRY.
Errors
DESCR fails when no table name is given, when anything other than ALPHA follows the table name, when no case variant names an existing table, or when the name matches tables in several schemas.
Related
Used in these how-tos
- How do I explore an unfamiliar database in fifteen minutes?
- How do I check that a deployment changed a table the same way in QA and production?
- How do I load a CSV file prepared in Excel into a table, with a preview first?
Last modified in release 5.5.0.
Found something wrong or unclear on this page? Tell us, with the page address.