Help Center/ AI DataLake/ Spark reference/ Table Related/ View Table/ Show All Columns of Specified Table
Updated on 2026-11-06 GMT+08:00

Show All Columns of Specified Table

Function

View all columns in a specified table. Use FROM/IN to specify the database to which the table belongs.

Syntax

SHOW COLUMNS { FROM | IN } table_name [ { FROM | IN } db_name ]

Parameters

Parameter

Mandatory

Description

table_name

Yes

Table name.

db_name

No

Database name. Used to qualify the database to which the table belongs.

FROM / IN

Yes (first group)

Specify the table whose columns are to be viewed. FROM and IN have the same function and are interchangeable.

FROM / IN

No (second group)

Specify the database to which the table belongs. Same function as the first group of keywords.

Precautions

  • The specified table must exist in the database. Otherwise, an error will occur.
  • The first group of FROM/IN is followed by the table name. The second group of FROM/IN is followed by the database name. Both have the same function but different positional meanings.

Example 1: View All Columns of a Table

View all columns in the student table.

SHOW COLUMNS FROM student;

Example result:

+---------+
|col_name |
+---------+
|id       |
|name     |
|age      |
|score    |
+---------+

Example 2: View Columns of a Table in a Specified Database

View all columns in the student table in the school_db database.

SHOW COLUMNS FROM student FROM school_db;

Example 3: View Columns of a Table Using the IN Keyword

View all columns in the student table using the IN keyword.

SHOW COLUMNS IN student;

Example 4: Specify a Database Using the IN Keyword

View all columns in the student table in the school_db database using the IN keyword.

SHOW COLUMNS IN student IN school_db;