Updated on 2022-02-22 GMT+08:00

SQL Syntax

DDM is fully compatible with MySQL licenses and syntax, but there are differences between distributed databases and single-node databases.

You can manually submit a transaction to execute SQL statements in batches to add, delete, or modify data records to, from or in data tables.

For example, use the following settings to execute SQL statements on a client:

set autocommit=0;

{sql operations};

commit;

This release supports operations only on the connected database using SQL statements. Otherwise, an exception may occur.

Table 1 Restrictions on DDL syntax

Item

Restriction

DDL syntax

  • ALTER statements cannot be used to modify databases or dbpartition/tbpartition columns.
  • TEMPORARY sharded and broadcast tables cannot be created.
  • Sharded and broadcast tables cannot be created from another table.
  • Only unsharded tables support foreign keys. Sharded and broadcast tables do not support such keys.
  • Unsharded tables can be created only from another unsharded or broadcast table.
  • CREATE TABLE Syntax and DROP TABLE Syntax do not support annotations and are not restricted by the sql_execute_timeout parameter.
Table 2 Syntax restrictions on DML

Item

Restriction

DELETE statement

  • PARTITION clauses are not supported.
  • Subqueries are not supported.

UPDATE statement

  • PARTITION clauses are not supported.
  • Subqueries are not supported.
Table 3 Restrictions on database administration statements

Item

Restriction

Database administration statements

  • SET syntax cannot be used to modify global variables.
  • SHOW TRIGGERS Syntax is not supported.
Table 4 Restrictions on advanced SQL functions

Item

Restriction

Advanced SQL functions

  • Customized data types and functions are not supported.
  • Views, stored procedures, triggers, and cursors are not supported.
  • Compound statements such as BEGIN...END, LOOP...END LOOP, REPEAT...UNTIL...END REPEAT, and WHILE...DO...END WHILE are not supported.
  • Process control statements such as IF and WHILE are not supported.