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.1.0

    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.1.0
    iconOceanBase Database
    SQL - V 4.1.0
    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

    General syntax

    Last Updated:2023-07-28 02:55:42  Updated
    share
    What is on this page
    Constants
    Character sets
    Collations
    Data types
    SQL properties
    Distributed properties
    Storage properties

    folded

    share

    This topic describes the general syntax of SQL statements, including the syntax of constants, character sets, data types, SQL properties, distributed properties, and storage properties.

    Constants

    • INT_VALUE: matches integer constants such as 123.

    • DECIMAL_VALUE: matches fixed-point constants such as 123.456.

    • STR_VALUE: matches string constants such as abc.

    • NULL: matches null constants.

    • STORAGE_SIZE: matches storage size constants. The default unit of integer values is bytes, and the unit of string values can be set to M or G. For example, the size can be 1024 or '500M'.

    const_value:
          INT_VALUE
        | DECIMAL_VALUE
        | STR_VALUE
        | NULL
        | STORAGE_SIZE
    
    STORAGE_SIZE:
          INT_VALUE
        | 'INT_VALUE[M|G]'
    

    Character sets

    charset:
          default_charset
        | column_charset
    
    default_charset:
        [DEFAULT] {CHARSET | CHARACTER SET} [=] {UTF8 | UTF8MB4 | BINARY}
    
    column_charset:
        {CHARSET | CHARACTER SET} {UTF8 | UTF8MB4 | BINARY}
    

    Collations

    collate:
          default_collate
        | column_collate
    
    default_collate:
        [DEFAULT] COLLATE [=] {UTF8MB4_GENERAL_CI | UTF8MB4_BIN | BINARY}
    
    column_collate:
        COLLATE {UTF8MB4_GENERAL_CI | UTF8MB4_BIN | BINARY}
    

    Data types

    data_type:
          TINYINT[(precision)] [UNSIGNED] [ZEROFILL]
        | SMALLINT[(precision)] [UNSIGNED] [ZEROFILL]
        | MEDIUMINT[(precision)] [UNSIGNED] [ZEROFILL]
        | INT[(precision)] [UNSIGNED] [ZEROFILL]
        | INTEGER[(precision)] [UNSIGNED] [ZEROFILL]
        | BIGINT[(precision)] [UNSIGNED] [ZEROFILL]
        | FLOAT[(precision, scale)] [UNSIGNED] [ZEROFILL]
        | DOUBLE[(precision, scale)] [UNSIGNED] [ZEROFILL]
        | DECIMAL[(precision [, scale])] [UNSIGNED] [ZEROFILL]
        | NUMERIC[(precision [, scale])] [UNSIGNED] [ZEROFILL]
        | DATETIME[(scale)]
        | TIMESTAMP[(scale)]
        | DATE
        | TIME[(scale)]
        | YEAR
        | VARCHAR(length) column_charset column_collate
        | VARBINARY(length)
        | CHAR[(length)] column_charset column_collate
        | BINARY[(length)]
        | TINYTEXT column_charset column_collate
        | TINYLOB
        | TEXT[(length)] column_charset column_collate
        | BLOB[(length)]
        | MEDIUMTEXT column_charset column_collate
        | MEDIUMBLOB
        | LONGTEXT column_charset column_collate
        | LONGBLOB
    
    precision | scale | length:
        INT_VALUE
    

    SQL properties

    • Object name

      tenant_name | pool_name | unit_name | zone_name | region_name:
          STR_VALUE
      
      database_name | table_name | table_alias_name | column_name| column_alias_name  | partition_name | subpartition_name:
          STR_VALUE
      
      index_name | view_name | object_name | constraint_name | tablegroup_name:
          STR_VALUE
      
      outline_name | user_name:
          STR_VALUE
      
      table_factor:
          [[database_name].] table_name
      
      column_factor:
          [table_factor.] column_name
      
    • Expressions

      expression:
            const_value
          | column_factor
          | operator_expression
          | function_expression
      
    • Comments

      comment:
          COMMENT 'comment_text'
      
      comment_text:
          STR_VALUE
      

    Distributed properties

    • PRIMARY_ZONE: specifies the leader distribution strategy for data.

      primary_zone:
      PRIMARY_ZONE [=] zone_name
      
    • ZONE_LIST: specifies the resource distribution strategy for a tenant.

      zone_list:
      ZONE_LIST [=] (zone_name [, zone_name ...])
      
    • REPLICA_NUM: specifies the number of replicas of data.

      replica_num:
      REPLICA_NUM [=] INT_VALUE
      
    • TABLEGROUP: specifies the leader distribution strategy for multiple data replicas.

      tablegroup:
            default_tablegroup
          | table_tablegroup
      
      default_tablegroup:
          DEFAULT TABLEGROUP [=] {tablegroup_name | NULL}
      
      table_tablegroup:
          TABLEGROUP [=] {tablegroup_name | NULL}
      

    Storage properties

    • BLOCK_SIZE: specifies the microblock size for object storage.

      block_size:
      BLOCK_SIZE [=] INT_VALUE
      
    • COMPRESSION: specifies the compression algorithm for object storage.

      compression:
      COMPRESSION [=] {NONE | LZ4_1.0 | LZ0_1.0 | SNAPPY_1.0 | ZLIB_1.0}
      
    • PCTFREE: specifies the macroblock reservation percentage for object storage.

      pctfree:
      PCTFREE [=] INT_VALUE
      
    • TABLET_SIZE: specifies the minimum tablet size of a single task in a parallel compaction.

      tablet_size:
      TABLET_SIZE [=] INT_VALUE
      

    Previous topic

    JOIN
    Last

    Next topic

    CTE
    Next
    What is on this page
    Constants
    Character sets
    Collations
    Data types
    SQL properties
    Distributed properties
    Storage properties