Skip to content

Commit d785e75

Browse files
authored
Merge pull request #10631 from BohuTANG/doc-select-1
docs(query): refine the with syntax
2 parents eed781b + 8f8b59d commit d785e75

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

docs/doc/14-sql-commands/20-query-syntax/02-dml-with.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,20 @@ ORDER BY customername;
3535
## Syntax
3636

3737
```sql
38-
WITH cte_name1 [(col_name [, col_name] ...)] AS (subquery1)
39-
[, cte_name2 [(col_name [, col_name] ...)] AS (subquery2)]
40-
[...]
38+
WITH
39+
<cte_name1> [ ( <cte_column_list> ) ] AS ( SELECT ... )
40+
[ , <cte_name2> [ ( <cte_column_list> ) ] AS ( SELECT ... ) ]
41+
[ , <cte_nameN> [ ( <cte_column_list> ) ] AS ( SELECT ... ) ]
4142
SELECT ...
4243
```
4344

4445
Where:
4546

4647
`WITH`: Initiates the WITH clause.
4748

48-
`cte_name1`: Specifies the name of the first result set.
49+
`<cte_name1>, <cte_nameN>`: The CTE name.
4950

50-
`subquery1`: Defines the first result set.
51-
52-
`cte_name2 AS (subquery2)`: You can define multiple CTEs in a WITH clause.
51+
`<cte_column_list>`: The names of the columns in the CTE.
5352

5453
- A CTE can refer to any CTEs in the same WITH clause that are defined before.
5554

0 commit comments

Comments
 (0)