Updated on 2026-11-06 GMT+08:00

Show Table Statistics

Function

View table statistics. By default, the column names and column data types of all columns are returned. Use EXTENDED or FORMATTED to view detailed table metadata information.

DESCRIBE and the abbreviation DESC are equivalent.

Syntax

{ DESCRIBE | DESC } [ EXTENDED | FORMATTED ] [ db_name. ] table_name

Parameters

Parameter

Mandatory

Description

DESCRIBE / DESC

Yes

Keyword for viewing table statistics. Both are equivalent. DESC is the abbreviation for DESCRIBE.

EXTENDED

No

Displays all metadata information of the table, including detailed table statistics and configuration information. Typically used during debugging.

FORMATTED

No

Displays all metadata information in a formatted table. Similar to EXTENDED but with more readable output.

db_name

No

Database name. If not specified, the current database is used by default. Naming rule: Only letters, digits, and underscores (_) are allowed. Cannot be purely numeric and cannot start with an underscore.

table_name

Yes

Table name. Naming rule: Only letters, digits, and underscores (_) are allowed. Cannot be purely numeric and cannot start with an underscore. The matching rule is ^(?!_)(?![0-9]+$)[A-Za-z0-9_$]*$. If it contains special characters, it must be enclosed in backticks (``).

Precautions

  • If the table being viewed does not exist, an error will occur.
  • By default, only column names and data types are returned. Use EXTENDED or FORMATTED to view complete metadata including partition information, storage format, table properties, etc.

Example 1: Basic DESCRIBE to View Table Information

View the column names and column data types of all columns in the student table.

DESCRIBE student;

Example result:

+---------+----------+-------+
|col_name |data_type |comment|
+---------+----------+-------+
|id       |int       |NULL   |
|name     |string    |NULL   |
|age      |int       |NULL   |
|score    |double    |NULL   |
+---------+----------+-------+

Example 2: Use the DESC Abbreviation

Use the DESC abbreviation to view column information of the student table. Equivalent to DESCRIBE.

DESC student;

Example 3: Use EXTENDED to View Detailed Information

View detailed metadata information of the student table, including partitions, storage format, table properties, etc.

DESCRIBE EXTENDED student;

The returned result will include:

  • Basic column information (column name, data type, comment)
  • Detailed table metadata (database, owner, creation time, storage format, table properties, etc.)

Example 4: View a Table in a Specified Database

View column information of the student table in the school_db database.

DESCRIBE school_db.student;