> ## 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.

> first_value 윈도 함수에 대한 문서

# first_value

정렬된 프레임에서 계산된 첫 번째 값을 반환합니다. 기본적으로 `NULL` 인수는 건너뛰지만, `RESPECT NULLS` 수정자를 사용하여 이 동작을 재정의할 수 있습니다.

**구문**

```sql theme={null}
first_value (column_name) [[RESPECT NULLS] | [IGNORE NULLS]]
  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])
```

별칭: `any`.

<Note>
  `first_value(column_name)` 뒤에 선택적 수정자 `RESPECT NULLS`를 사용하면 `NULL` 인수를 건너뛰지 않습니다.
  자세한 내용은 [NULL 처리](/ko/reference/functions/aggregate-functions#null-processing)를 참조하십시오.

  별칭: `firstValueRespectNulls`
</Note>

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

**반환 값**

* 정렬된 프레임 내에서 평가되는 첫 번째 값입니다.

**예시**

이 예시에서는 `first_value` 함수를 사용하여 Premier League 축구 선수 급여로 구성된 가상의 데이터셋에서 가장 높은 급여를 받는 선수를 찾습니다.

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

INSERT INTO salaries FORMAT VALUES
    ('Port Elizabeth Barbarians', 'Gary Chen', 196000, 'F'),
    ('New Coreystad Archdukes', 'Charles Juarez', 190000, 'F'),
    ('Port Elizabeth Barbarians', 'Michael Stanley', 100000, 'D'),
    ('New Coreystad Archdukes', 'Scott Harrison', 180000, '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, 
       first_value(player) OVER (ORDER BY salary DESC) AS highest_paid_player
FROM salaries;
```

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