OceanBase logo

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Resources

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS

OceanBase Cloud

OceanBase Database

Tools

Connectors and Middleware

QUICK START

OceanBase Cloud

OceanBase Database

BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Company

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

International - English
中国站 - 简体中文
日本 - 日本語
Sign In
Start on Cloud

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS
OceanBase CloudOceanBase Database
ToolsConnectors and Middleware
QUICK START
OceanBase CloudOceanBase Database
BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

Start on Cloud
编组
All Products
    • Databases
    • iconOceanBase Database
    • iconOceanBase Cloud
    • iconOceanBase Tugraph
    • iconInteractive Tutorials
    • iconOceanBase Best Practices
    • Tools
    • iconOceanBase Cloud Platform
    • iconOceanBase Migration Service
    • iconOceanBase Developer Center
    • iconOceanBase Migration Assessment
    • iconOceanBase Admin Tool
    • iconOceanBase Loader and Dumper
    • iconOceanBase Deployer
    • iconKubernetes operator for OceanBase
    • iconOceanBase Diagnostic Tool
    • iconOceanBase Binlog Service
    • Connectors and Middleware
    • iconOceanBase Database Proxy
    • iconEmbedded SQL in C for OceanBase
    • iconOceanBase Call Interface
    • iconOceanBase Connector/C
    • iconOceanBase Connector/J
    • iconOceanBase Connector/ODBC
    • iconOceanBase Connector/NET
icon

OceanBase Database

SQL - V4.3.1

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogLive DemosTraining & CertificationTicket
    Company
    About OceanBaseTrust CenterLegalPartnerContact Us
    Follow Us

    © OceanBase 2026. All rights reserved

    Cloud Service AgreementPrivacy PolicySecurity
    Contact Us
    Document Feedback
    1. Documentation Center
    2. OceanBase Database
    3. SQL
    4. V4.3.1
    iconOceanBase Database
    SQL - V 4.3.1
    Databases
    • OceanBase Database
    • OceanBase Cloud
    • OceanBase Tugraph
    • Interactive Tutorials
    • OceanBase Best Practices
    Tools
    • OceanBase Cloud Platform
    • OceanBase Migration Service
    • OceanBase Developer Center
    • OceanBase Migration Assessment
    • OceanBase Admin Tool
    • OceanBase Loader and Dumper
    • OceanBase Deployer
    • Kubernetes operator for OceanBase
    • OceanBase Diagnostic Tool
    • OceanBase Binlog Service
    Connectors and Middleware
    • OceanBase Database Proxy
    • Embedded SQL in C for OceanBase
    • OceanBase Call Interface
    • OceanBase Connector/C
    • OceanBase Connector/J
    • OceanBase Connector/ODBC
    • OceanBase Connector/NET
    SQL
    KV
    • V 4.6.0
    • V 4.4.2
    • V 4.3.5
    • V 4.3.3
    • V 4.3.1
    • V 4.3.0
    • V 4.2.5
    • V 4.2.2
    • V 4.2.1
    • V 4.2.0
    • V 4.1.0
    • V 4.0.0
    • V 3.1.4 and earlier

    Query tables

    Last Updated:2026-04-15 08:25:14  Updated
    Share
    What is on this page
    Query all tables in a database
    Query the definition of a table
    Query the schema of a table

    folded

    Share

    After you create a table, you can query its definition and schema or query all tables in the database by using SQL statements.

    Query all tables in a database

    You can use the SHOW TABLES statement to query all tables in a database. Here is a sample statement:

    SHOW [EXTENDED] [FULL] TABLES [{FROM | IN} database_name];
    

    where:

    • EXTENDED specifies to show hidden tables. This keyword does not take effect because the current version of OceanBase Database does not generate hidden tables.

    • FULL specifies to show the table type.

    • database_name specifies the name of the database whose tables are to be queried.

    The following example queries all tables in the test database.

    SHOW TABLES FROM test;
    

    The query result is as follows:

    +----------------+
    | Tables_in_test |
    +----------------+
    | t1             |
    +----------------+
    1 row in set
    

    For more information about the SHOW TABLES statement, see SHOW.

    Query the definition of a table

    After you create a table, you can use the SHOW CREATE TABLE statement to query the definition of the table.

    The following example queries the definition of the test table.

    obclient [test]> SHOW CREATE TABLE test;
    

    The query result is as follows:

    +-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    | Table | Create Table                                                                                                                                                                                                                                                  |
    +-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    | test  | CREATE TABLE `test` (
      `id` int(11) DEFAULT NULL,
      `name` char(50) DEFAULT NULL
    ) DEFAULT CHARSET = utf8mb4 ROW_FORMAT = DYNAMIC COMPRESSION = 'zstd_1.3.8' REPLICA_NUM = 1 BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 0 |
    +-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    1 row in set
    

    where

    • DEFAULT CHARSET = utf8mb4 indicates that the default character set is utf8mb4.

    • ROW_FORMAT = DYNAMIC indicates that data encoding is enabled.

    • COMPRESSION indicates the compression method of the table.

    • PCTFREE indicates the space reserved for updating this data block.

    Query the schema of a table

    After you create a table, you can use the SHOW COLUMNS/FIELDS statement to query the schema of the table. Here is a sample statement:

    SHOW [EXTENDED] [FULL] {COLUMNS | FIELDS}
        {FROM | IN} table_name
        [{FROM | IN} database_name];
    

    where:

    • EXTENDED specifies to show hidden columns.

    • FULL specifies to show the collation, privileges, and comments of columns.

    • table_name specifies the name of the table whose schema is to be queried.

    • database_name specifies the name of the database to which the table belongs.

    Here are two examples:

    • The following example queries the schema of the test table.

      obclient [test]> SHOW COLUMNS FROM test;
      

      The query result is as follows:

      +-------+----------+------+-----+---------+-------+
      | Field | Type     | Null | Key | Default | Extra |
      +-------+----------+------+-----+---------+-------+
      | id    | int(11)      | YES  |     | NULL    |       |
      | name  | varchar(50) | YES  |     | NULL    |       |
      +-------+----------+------+-----+---------+-------+
      2 rows in set
      
    • The following example views all columns, including hidden columns, in the test table.

      obclient [test]> SHOW EXTENDED COLUMNS FROM test;
      

      The query result is as follows:

      +----------------+-----------------+------+-----+---------+-------+
      | Field          | Type            | Null | Key | Default | Extra |
      +----------------+-----------------+------+-----+---------+-------+
      | id             | int(11)         | YES  |     | NULL    |       |
      | name           | char(50)        | YES  |     | NULL    |       |
      | __pk_increment | bigint unsigned | NO   | PRI | NULL    |       |
      +----------------+-----------------+------+-----+---------+-------+
      3 rows in set
      

    For more information about the SHOW COLUMNS/FIELDS statement, see SHOW.

    Previous topic

    Define column constraints
    Last

    Next topic

    Modify a table
    Next
    What is on this page
    Query all tables in a database
    Query the definition of a table
    Query the schema of a table