Updated on 2024-07-04 GMT+08:00

Viewing Table Statistics

Function

This statement is used to check table statistics. The names and data types of all columns in a specified table will be returned.

Syntax

1
DESCRIBE [EXTENDED|FORMATTED] [db_name.]table_name;

Keywords

  • EXTENDED: displays all metadata of the specified table. It is used during debugging in general.
  • FORMATTED: displays all metadata of the specified table in a form.

Parameters

Table 1 Parameters

Parameter

Description

db_name

Database name that contains letters, digits, and underscores (_). It cannot contain only digits or start with an underscore (_).

table_name

Table name of a database that contains letters, digits, and underscores (_). It cannot contain only digits or start with an underscore (_). The matching rule is ^(?!_)(?![0-9]+$)[A-Za-z0-9_$]*$. If special characters are required, use single quotation marks ('') to enclose them.

Precautions

The to-be-queried table must exist. If this statement is used to query the information about a table that does not exist, an error is reported.

Example

To query the names and data types of all columns in the student table, run the following statement:

1
DESCRIBE student;