Overview
DDM supports common DDL operations, such as creating databases, creating tables, and modifying table structure, but uses different implementation methods from common MySQL databases.
DDL Statements that Can Be Executed on a MySQL Client
- RENAME TABLE cannot be executed together with any other DDL statements.
- If you change the field name of a sharded table while executing a query statement containing SELECT * [DDL-related tables], an exception may occur indicating that the column name is not found. In this case, you are advised to perform a modification during off-peak hours and run queries after the modification is complete.
- When the DDM instance or its associated RDS instances are overloaded, if you delete the field name of a sharded table while executing a query statement containing SELECT * [DDL-related tables], an exception may occur indicating that the column name is not found. In this case, you are advised to perform a deletion during off-peak hours and run queries after the deletion is complete.
- TRUNCATE Syntax
TRUNCATE TABLE t1;
Deletes all data from table t1.
TRUNCATE TABLE has the DROP permission and can delete all data from a table. In logic, TRUNCATE TABLE is similar to the DELETE statement that can delete all rows from a table.
- ALTER TABLE Syntax
ALTER TABLE t2 DROP COLUMN c, DROP COLUMN d;
Changes the structure of table t2 and deletes columns c and d from table t2.
ALTER can add or delete a column, create or drop an index, change the type of an existing column, rename columns or tables, or change the storage engine for tables or table comments.
- DROP INDEX Syntax
DROP INDEX `PRIMARY` ON t;
Deletes the primary key of table t.
DROP INDEX can delete index index_name from table tbl_name.
- CREATE INDEX Syntax
CREATE INDEX part_of_name ON customer (name(10));
Creates an index using the first 10 characters in column name (assuming that there are non-binary character strings in column name).
CREATE INDEX can add an index to an existing table.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot