diff --git a/product/en/docs-mogdb/v2.1/reference-guide/sql-syntax/74-DELETE.md b/product/en/docs-mogdb/v2.1/reference-guide/sql-syntax/74-DELETE.md index bf19c08e12052eb517499165d7fba24501b0f6cd..14b6e177965eb05eda574695ee545557e8e33117 100644 --- a/product/en/docs-mogdb/v2.1/reference-guide/sql-syntax/74-DELETE.md +++ b/product/en/docs-mogdb/v2.1/reference-guide/sql-syntax/74-DELETE.md @@ -20,7 +20,7 @@ date: 2021-05-10 ```ebnf+diagram Delete ::= [ WITH [ RECURSIVE ] with_query [, ...] ] -DELETE [/*+ plan_hint */] FROM [ ONLY ] table_name [ * ] [ [ AS ] alias ] +DELETE [/*+ plan_hint */] [ FROM ] [ ONLY ] table_name [ * ] [ [ AS ] alias ] [ USING using_list ] [ WHERE condition | WHERE CURRENT OF cursor_name ] [ RETURNING { * | { output_expr [ [ AS ] output_name ] } [, ...] } ]; @@ -36,16 +36,15 @@ DELETE [/*+ plan_hint */] FROM [ ONLY ] table_name [ * ] [ [ AS ] alias ] Format of **with_query**: - ```sql - with_query_name [ ( column_name [, ...] ) ] AS - + ```ebnf+diagram + with_query_name ::= with_query_name [ ( column_name [, ...] ) ] AS ( {select | values | insert | update | delete} ) ``` - + - **with_query_name** specifies the name of the result set generated by a subquery. Such names can be used to access the subquery result set. - **column_name** specifies the column name displayed in the subquery result set. - Each subquery can be a **SELECT**, **VALUES**, **INSERT**, **UPDATE** or **DELETE** statement. - + - **plan_hint** clause Follows the **DELETE** keyword in the **/\*+ \*/** format. It is used to optimize the plan of a **DELETE** statement block. For details, see [Hint-based Tuning](9-hint-based-tuning). In each statement, only the first **/\*+** _plan_hint _***/** comment block takes effect as a hint. Multiple hints can be written. diff --git a/product/zh/docs-mogdb/v2.1/reference-guide/sql-syntax/74-DELETE.md b/product/zh/docs-mogdb/v2.1/reference-guide/sql-syntax/74-DELETE.md index 95faa18ef1fd972b67e1f58f40b72f37ef4f4d33..1c9b230e6fc579207056bd8ba914642e9edda147 100644 --- a/product/zh/docs-mogdb/v2.1/reference-guide/sql-syntax/74-DELETE.md +++ b/product/zh/docs-mogdb/v2.1/reference-guide/sql-syntax/74-DELETE.md @@ -1,8 +1,8 @@ --- title: DELETE summary: DELETE -author: Zhang Cuiping -date: 2021-05-10 +author: GUO HUAN +date: 2022-04-15 --- # DELETE @@ -20,7 +20,7 @@ DELETE从指定的表里删除满足WHERE子句的行。如果WHERE子句不存 ```ebnf+diagram Delete ::= [ WITH [ RECURSIVE ] with_query [, ...] ] -DELETE FROM [ ONLY ] table_name [ * ] [ [ AS ] alias ] +DELETE [/*+ plan_hint */] [ FROM ] [ ONLY ] table_name [ * ] [ [ AS ] alias ] [ USING using_list ] [ WHERE condition | WHERE CURRENT OF cursor_name ] [ RETURNING { * | { output_expr [ [ AS ] output_name ] } [, ...] } ]; @@ -30,22 +30,25 @@ DELETE FROM [ ONLY ] table_name [ * ] [ [ AS ] alias ] - **WITH [ RECURSIVE ] with_query [, …]** - 用于声明一个或多个可以在主查询中通过名称引用的子查询,相当于临时表。 + 用于声明一个或多个可以在主查询中通过名称引用的子查询,相当于临时表。 - 如果声明了RECURSIVE,那么允许SELECT子查询通过名称引用它自己。 + 如果声明了RECURSIVE,那么允许SELECT子查询通过名称引用它自己。 - 其中with_query的详细格式为: + 其中with_query的详细格式为: - with_query_name [ ( column_name [, …] ) ] AS - - ( {select | values | insert | update | delete} ) + ```ebnf+diagram + with_query_name ::= with_query_name [ ( column_name [, ...] ) ] AS + ( {select | values | insert | update | delete} ) + ``` - with_query_name指定子查询生成的结果集名称,在查询中可使用该名称访问子查询的结果集。 - - column_name指定子查询结果集中显示的列名。 - - 每个子查询可以是SELECT,VALUES,INSERT,UPDATE或DELETE语句。 +- **plan_hint子句** + + 以`/*+ */`的形式在DELETE关键字后,用于对DELETE对应的语句块生成的计划进行hint调优,详细用法请参见章节[使用Plan Hint进行调优](9-hint-based-tuning)。每条语句中只有第一个`/*+ plan_hint */`注释块会作为hint生效,里面可以写多条hint。 + - **ONLY** 如果指定ONLY则只有该表被删除;如果没有声明,则该表和它的所有子表将都被删除。