Skip to content

Commit a598e7b

Browse files
committed
update
1 parent b2fcdd4 commit a598e7b

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

docs/source/user-guide/sql/aggregate_functions.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ Note: When no rows pass the filter, `COUNT` returns `0` while `SUM`/`AVG`/`MIN`/
6565
- [mean](#mean)
6666
- [median](#median)
6767
- [min](#min)
68+
- [percentile_cont](#percentile_cont)
6869
- [string_agg](#string_agg)
6970
- [sum](#sum)
7071
- [var](#var)
@@ -388,6 +389,41 @@ min(expression)
388389
+----------------------+
389390
```
390391

392+
### `percentile_cont`
393+
394+
Returns the exact percentile of input values, interpolating between values if needed.
395+
396+
```sql
397+
percentile_cont(percentile) WITHIN GROUP (ORDER BY expression)
398+
```
399+
400+
#### Arguments
401+
402+
- **expression**: The expression to operate on. Can be a constant, column, or function, and any combination of operators.
403+
- **percentile**: Percentile to compute. Must be a float value between 0 and 1 (inclusive).
404+
405+
#### Example
406+
407+
```sql
408+
> SELECT percentile_cont(0.75) WITHIN GROUP (ORDER BY column_name) FROM table_name;
409+
+----------------------------------------------------------+
410+
| percentile_cont(0.75) WITHIN GROUP (ORDER BY column_name) |
411+
+----------------------------------------------------------+
412+
| 45.5 |
413+
+----------------------------------------------------------+
414+
```
415+
416+
An alternate syntax is also supported:
417+
418+
```sql
419+
> SELECT percentile_cont(column_name, 0.75) FROM table_name;
420+
+---------------------------------------+
421+
| percentile_cont(column_name, 0.75) |
422+
+---------------------------------------+
423+
| 45.5 |
424+
+---------------------------------------+
425+
```
426+
391427
### `string_agg`
392428

393429
Concatenates the values of string expressions and places separator values between them. If ordering is required, strings are concatenated in the specified order. This aggregation function can only mix DISTINCT and ORDER BY if the ordering expression is exactly the same as the first argument expression.

0 commit comments

Comments
 (0)