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

> lead 윈도 함수에 대한 문서

# lead

정렬된 프레임에서 현재 행으로부터 `offset`개 뒤에 있는 행의 값을 반환합니다.
이 함수는 [`leadInFrame`](/ko/reference/functions/window-functions/leadInFrame)과 유사하지만, 항상 `ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING` 프레임을 사용합니다.

**구문**

```sql theme={null}
lead(x[, offset[, default]])
  OVER ([[PARTITION BY grouping_column] [ORDER BY sorting_column]] | [window_name])
FROM table_name
WINDOW window_name as ([[PARTITION BY grouping_column] [ORDER BY sorting_column])
```

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

**매개변수**

* `x` — 컬럼 이름입니다.
* `offset` — 적용할 오프셋입니다. [(U)Int\*](/ko/reference/data-types/int-uint). (선택 사항 - 기본값은 `1`입니다)
* `default` — 계산된 행이 윈도우 프레임의 경계를 벗어날 경우 반환할 값입니다. (선택 사항 - 생략하면 컬럼 타입의 기본값이 사용됩니다)

**반환 값**

* 정렬된 프레임 내에서 현재 행으로부터 `offset`개 뒤에 있는 행에서 평가된 값입니다.

**예시**

이 예시에서는 노벨상 수상자의 [과거 데이터](https://www.kaggle.com/datasets/sazidthe1/nobel-prize-data)를 살펴보고, `lead` 함수를 사용해 물리학 부문의 연속 수상자 목록을 반환합니다.

```sql title="Query" theme={null}
CREATE OR REPLACE VIEW nobel_prize_laureates
AS SELECT *
FROM file('nobel_laureates_data.csv');
```

```sql title="Query" theme={null}
SELECT
    fullName,
    lead(year, 1, year) OVER (PARTITION BY category ORDER BY year ASC
      ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING
    ) AS year,
    category,
    motivation
FROM nobel_prize_laureates
WHERE category = 'physics'
ORDER BY year DESC
LIMIT 9
```

```response title="Query" theme={null}
   ┌─fullName─────────┬─year─┬─category─┬─motivation─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
1. │ Anne L Huillier  │ 2023 │ physics  │ for experimental methods that generate attosecond pulses of light for the study of electron dynamics in matter                     │
2. │ Pierre Agostini  │ 2023 │ physics  │ for experimental methods that generate attosecond pulses of light for the study of electron dynamics in matter                     │
3. │ Ferenc Krausz    │ 2023 │ physics  │ for experimental methods that generate attosecond pulses of light for the study of electron dynamics in matter                     │
4. │ Alain Aspect     │ 2022 │ physics  │ for experiments with entangled photons establishing the violation of Bell inequalities and  pioneering quantum information science │
5. │ Anton Zeilinger  │ 2022 │ physics  │ for experiments with entangled photons establishing the violation of Bell inequalities and  pioneering quantum information science │
6. │ John Clauser     │ 2022 │ physics  │ for experiments with entangled photons establishing the violation of Bell inequalities and  pioneering quantum information science │
7. │ Giorgio Parisi   │ 2021 │ physics  │ for the discovery of the interplay of disorder and fluctuations in physical systems from atomic to planetary scales                │
8. │ Klaus Hasselmann │ 2021 │ physics  │ for the physical modelling of Earths climate quantifying variability and reliably predicting global warming                        │
9. │ Syukuro Manabe   │ 2021 │ physics  │ for the physical modelling of Earths climate quantifying variability and reliably predicting global warming                        │
   └──────────────────┴──────┴──────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
```
