ANSI Compatibility
GreptimeDB supports a subset of ANSI SQL and has some unique extensions. Some major incompatibilities and extensions are described below:
- Create a table:
- Supports the unique 
TIME INDEXconstraint. Please refer to the Data Model and the CREATE table creation syntax for details. - Currently only supports 
PRIMARY KEYconstraints and does not support other types of constraints or foreign keys. - GreptimeDB is a native distributed database, so the table creation syntax for distributed tables supports partitioning rules. Please also refer to the CREATE.
 
 - Supports the unique 
 - Insert data: Consistent with ANSI SQL syntax, but requires the 
TIME INDEXcolumn value (or default value) to be provided. - Update data: Does not support 
UPDATEsyntax, but if the primary key andTIME INDEXcorresponding column values are the same duringINSERT, subsequent inserted rows will overwrite previously written rows, effectively achieving an update.- Since 0.8, GreptimeDB supports append mode that creates an append-only table with 
append_mode="true"option which keeps duplicate rows. 
 - Since 0.8, GreptimeDB supports append mode that creates an append-only table with 
 - Query data: Query syntax is compatible with ANSI SQL, with some functional differences and omissions.
- Does not support views.
 - TQL syntax extension: Supports executing PromQL in SQL via TQL subcommands. Please refer to the TQL section for details.
 - Range Query to query and aggregate data within a range of time.
 
 - Delete data: Deletion syntax is basically consistent with ANSI SQL.
 - Others:
- Identifiers such as table names and column names have constraints similar to ANSI SQL, are case sensitive, and require double quotes when encountering special characters or uppercase letters.
 - GreptimeDB has optimized identifier rules for different dialects. For example, when you connect with a MySQL or PostgreSQL client, you can use identifier rules specific to that SQL dialect, such as using backticks 
`for MySQL and standard double quotes"for PostgreSQL.