Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: improved en version of sql/dql/group_by #2241

Merged
merged 1 commit into from
Jul 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions docs/en/reference/sql/dql/GROUP_BY_CLAUSE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# GROUP BY Clause

All -group by- currently only has supports in batch mode (that is, console debugging SQL support, offline mode is still under development)

## Syntax

```SQL
Expand All @@ -17,25 +15,23 @@ SELECT select_expr [,select_expr...] FROM ... GROUP BY ...

## Boundary Description
lumianph marked this conversation as resolved.
Show resolved Hide resolved

| SELECT statement elements | state | directions |
| :-------------- | ------------- | :----------------------------------------------------------- |
| GROUP BY Clause | Online not supported | Group By clause is used to group the query result set. Grouping expression lists only support simple columns. |

For the standalone version, `GROUP BY` is supported in all conditions. For the cluster version, the execution modes which support this clause are shown below.

| `SELECT` Statement Elements | Offline Mode | Online Preview Mode | Online Request Mode | Note |
|:-----------------------------------------------------------|--------------|---------------------|---------------------|:------------------------------------------------------------------------------------------------------------------------|
| GROUP BY Clause | **``✓``** | | | The Group By clause is used to group the query results.The grouping conditions only support grouping on simple columns. |

## Example

### 1. Aggregate After Grouping By Column
**1. Aggregate After Grouping By One Column**

```SQL
-- desc: simple SELECT grouping KEY
SELECT COL1, SUM(COL2), AVG(COL2) FROM t1 group by COL1;
SELECT COL1, SUM(COL2), AVG(COL2) FROM t1 group by COL1;
```

### 2. Aggregate After Grouping By Two Columns
**2. Aggregate After Grouping By Two Columns**

```SQL
-- desc: simple SELECT grouping KEY
SELECT COL1, SUM(COL2), AVG(COL2) FROM t1 group by COL1, COL0;
SELECT COL1, SUM(COL2), AVG(COL2) FROM t1 group by COL1, COL0;
```