> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-fix-nav-issues.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> dense_rank 윈도 함수에 대한 문서

# dense_rank

현재 행에 대해 해당 파티션 내 순위를 매기며, 순위 사이에 빈 순위가 생기지 않습니다. 즉, 새로 만난 행의 값이 이전 행 중 하나의 값과 같으면 순위에 공백 없이 바로 다음 순위를 부여합니다.

[rank](/ko/reference/functions/window-functions/rank) 함수는 동일하게 동작하지만, 순위 사이에 빈 순위가 생깁니다.

**구문**

별칭: `denseRank` (대소문자 구분)

```sql theme={null}
dense_rank ()
  OVER ([[PARTITION BY grouping_column] [ORDER BY sorting_column]
        [ROWS or RANGE expression_to_bound_rows_withing_the_group]] | [window_name])
FROM table_name
WINDOW window_name as ([[PARTITION BY grouping_column] [ORDER BY sorting_column])
```

윈도 함수 구문에 관한 자세한 내용은 [윈도우 함수 - 구문](/ko/reference/functions/window-functions#syntax)을 참조하십시오.

**반환 값**

* 현재 행이 속한 파티션 내에서 순위가 건너뛰어지지 않는 번호입니다. [UInt64](/ko/reference/data-types/int-uint).

**예시**

다음 예시는 동영상 튜토리얼 [ClickHouse에서 순위 윈도우 함수 사용하기](https://youtu.be/Yku9mmBYm_4?si=XIMu1jpYucCQEoXA)에서 제공된 예시를 바탕으로 합니다.

```sql title="Query" theme={null}
CREATE TABLE salaries
(
    `team` String,
    `player` String,
    `salary` UInt32,
    `position` String
)
Engine = Memory;

INSERT INTO salaries FORMAT Values
    ('Port Elizabeth Barbarians', 'Gary Chen', 195000, 'F'),
    ('New Coreystad Archdukes', 'Charles Juarez', 190000, 'F'),
    ('Port Elizabeth Barbarians', 'Michael Stanley', 150000, 'D'),
    ('New Coreystad Archdukes', 'Scott Harrison', 150000, 'D'),
    ('Port Elizabeth Barbarians', 'Robert George', 195000, 'M'),
    ('South Hampton Seagulls', 'Douglas Benson', 150000, 'M'),
    ('South Hampton Seagulls', 'James Henderson', 140000, 'M');
```

```sql title="Query" theme={null}
SELECT player, salary,
       dense_rank() OVER (ORDER BY salary DESC) AS dense_rank
FROM salaries;
```

```response title="Response" theme={null}
   ┌─player──────────┬─salary─┬─dense_rank─┐
1. │ Gary Chen       │ 195000 │          1 │
2. │ Robert George   │ 195000 │          1 │
3. │ Charles Juarez  │ 190000 │          2 │
4. │ Michael Stanley │ 150000 │          3 │
5. │ Douglas Benson  │ 150000 │          3 │
6. │ Scott Harrison  │ 150000 │          3 │
7. │ James Henderson │ 140000 │          4 │
   └─────────────────┴────────┴────────────┘
```
