Skip to content

Commit b22e956

Browse files
authored
Merge pull request #10629 from BohuTANG/doc-select
docs(query): add query syntax index
2 parents 2b313c7 + 8c310f2 commit b22e956

File tree

3 files changed

+38
-18
lines changed

3 files changed

+38
-18
lines changed

docs/doc/14-sql-commands/20-query-syntax/01-dml-select.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,22 @@ Retrieves data from a table.
77
## Syntax
88

99
```sql
10+
[WITH]
1011
SELECT
1112
[ALL | DISTINCT]
12-
select_expr [[AS] alias], ...
13-
[INTO variable [, ...]]
14-
[EXCLUDE (col_name1 [, col_name2, col_name3, ...] ) ]
13+
<select_expr> [[AS] alias], ...
14+
[EXCLUDE (<col_name1> [, <col_name2>, <col_name3>, ...] ) ]
1515
[FROM table_references
1616
[AT ...]
17-
[WHERE expr]
18-
[GROUP BY {{col_name | expr | col_alias | col_position}, ...
19-
| extended_grouping_expr}]
20-
[HAVING expr]
21-
[ORDER BY {col_name | expr | col_alias | col_position} [ASC | DESC], [ NULLS { FIRST | LAST }]
22-
[LIMIT row_count]
23-
[OFFSET row_count]
17+
[WHERE <expr>]
18+
[GROUP BY {{<col_name> | <expr> | <col_alias> | <col_position>},
19+
... | <extended_grouping_expr>}]
20+
[HAVING <expr>]
21+
[ORDER BY {<col_name> | <expr> | <col_alias> | <col_position>} [ASC | DESC],
22+
[ NULLS { FIRST | LAST }]
23+
[LIMIT <row_count>]
24+
[OFFSET <row_count>]
2425
[IGNORE_RESULT]
25-
]
26-
]
2726
```
2827

2928
:::tip
@@ -43,7 +42,7 @@ SELECT number FROM numbers(3);
4342
+--------+
4443
```
4544

46-
### EXCLUDE Parameter
45+
## EXCLUDE Parameter
4746

4847
Excludes one or more columns by their names from the result. The parameter is usually used in conjunction with `SELECT * ...` to exclude a few columns from the result instead of retrieving them all.
4948

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
{
2-
"label": "Query Syntax",
3-
"link": {
4-
"type": "generated-index",
5-
"slug": "/reference/sql/query-syntax"
6-
}
2+
"label": "Query Syntax"
73
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
title: Query Syntax
3+
slug: ./
4+
---
5+
6+
Databend supports querying using [SELECT](./01-dml-select.md) and the following basic syntax:
7+
8+
```sql
9+
[WITH]
10+
SELECT
11+
[ALL | DISTINCT]
12+
<select_expr> [[AS] alias], ...
13+
[EXCLUDE (<col_name1> [, <col_name2>, <col_name3>, ...] ) ]
14+
[FROM table_references
15+
[AT ...]
16+
[WHERE <expr>]
17+
[GROUP BY {{<col_name> | <expr> | <col_alias> | <col_position>},
18+
... | <extended_grouping_expr>}]
19+
[HAVING <expr>]
20+
[ORDER BY {<col_name> | <expr> | <col_alias> | <col_position>} [ASC | DESC],
21+
[ NULLS { FIRST | LAST }]
22+
[LIMIT <row_count>]
23+
[OFFSET <row_count>]
24+
[IGNORE_RESULT]
25+
```

0 commit comments

Comments
 (0)