Skip to content
This repository was archived by the owner on Aug 16, 2022. It is now read-only.

Commit 2dffb4c

Browse files
author
ashwinkumar12345
committed
removed from functions
1 parent 5cc92f6 commit 2dffb4c

File tree

1 file changed

+0
-51
lines changed

1 file changed

+0
-51
lines changed

docs/sql/functions.md

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -131,54 +131,3 @@ Function | Specification | Example
131131
if | `if(boolean, es_type, es_type) -> es_type` | `SELECT if(false, 0, 1) FROM my-index LIMIT 1`, `SELECT if(true, 0, 1) FROM my-index LIMIT 1`
132132
ifnull | `ifnull(es_type, es_type) -> es_type` | `SELECT ifnull('hello', 1) FROM my-index LIMIT 1`, `SELECT ifnull(null, 1) FROM my-index LIMIT 1`
133133
isnull | `isnull(es_type) -> integer` | `SELECT isnull(null) FROM my-index LIMIT 1`, `SELECT isnull(1) FROM my-index LIMIT 1`
134-
135-
## Ranking
136-
137-
Ranking functions assign an incremental rank to each row in the frame.
138-
139-
If the ranking function is not used with the window definition that defines the order of data rows, the result is undetermined.
140-
141-
### ROW_NUMBER
142-
143-
`ROW_NUMBER` assigns a row number to data rows in a random order. As a special case, the row number is always increased by 1 regardless of the fields specified in the `ORDER BY` list.
144-
145-
```sql
146-
od> SELECT gender, balance, ROW_NUMBER() OVER(PARTITION BY gender ORDER BY balance) AS num FROM accounts;
147-
```
148-
149-
| gender | balance | num
150-
:--- | :---
151-
| F | 32838 | 1
152-
| M | 4180 | 1
153-
| M | 5686 | 2
154-
| M | 39225 | 3
155-
156-
### RANK
157-
158-
The `RANK` function assigns a rank to each row. For rows that have the same values for fields specified in the `ORDER BY` list, the same rank is assigned. If this is the case, the next few ranks is skipped depending on the number of ties.
159-
160-
```sql
161-
od> SELECT gender, RANK() OVER(ORDER BY gender DESC) AS rnk FROM accounts;
162-
```
163-
164-
| gender | rank
165-
:--- | :---
166-
| M | 1
167-
| M | 1
168-
| M | 1
169-
| F | 4
170-
171-
### DENSE_RANK
172-
173-
Similar to the `RANK` function, `DENSE_RANK` also assigns a rank to each row. The difference is there is no gap between the ranks.
174-
175-
```sql
176-
SELECT gender, DENSE_RANK() OVER(ORDER BY gender DESC) AS rnk FROM accounts;
177-
```
178-
179-
| gender | rank
180-
:--- | :---
181-
| M | 1
182-
| M | 1
183-
| M | 1
184-
| F | 2

0 commit comments

Comments
 (0)