> For the complete documentation index, see [llms.txt](https://docs.tibero.com/tibero-manuals/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tibero.com/tibero-manuals/7.2.6.manuals/tibero-sql-reference-guide/sql-elements/null.md).

# NULL

## NULL

한 로우의 어떤 컬럼에 값이 없으면 해당 컬럼은 NULL입니다. NULL은 값이 0이라는 뜻이 아닙니다. 값이 없거나 아직 알 수 없다는 뜻입니다.

NULL은 `NOT NULL` 제약과 `PRIMARY KEY` 제약이 없는 컬럼에 저장할 수 있습니다. 문자 타입 컬럼에 빈 문자열(`''`)을 저장하면 NULL로 처리합니다.

### 연산에서의 NULL

NULL을 포함한 산술 연산 결과는 항상 NULL입니다. 문자열 연결 연산(`||`)을 제외한 대부분의 연산도 NULL을 포함하면 결과가 NULL입니다.

```sql
NULL + 1 = NULL
```

### 함수에서의 NULL

`REPLACE`, `NVL`, `CONCAT`을 제외한 대부분의 함수는 파라미터가 NULL이면 반환값도 NULL입니다.

`NVL` 함수는 NULL을 다른 값으로 바꿔 반환할 때 사용합니다.

* 컬럼 값이 NULL이면 `NVL(column, 0) = 0`입니다.
* 컬럼 값이 NULL이 아니면 `NVL(column, 0) = column`입니다.
* 대부분의 집단 함수는 NULL을 무시합니다.

다음은 NULL을 포함한 데이터에 `AVG` 함수를 적용한 예시입니다.

```sql
DATA = {1000, 500, NULL, NULL, 1500}
AVG(DATA) = (1000 + 500 + 1500) / 3 = 1000
```

### NULL 비교 조건

NULL을 검사할 때는 `IS NULL`과 `IS NOT NULL`만 사용할 수 있습니다.

NULL은 데이터가 없다는 뜻입니다. 따라서 NULL과 NULL, 또는 NULL과 다른 값을 일반 비교 연산자로 비교할 수 없습니다.

하지만 `DECODE` 함수 안에서는 두 NULL을 같은 값으로 비교할 수 있습니다.

```sql
SELECT DECODE(NULL, NULL, 1) FROM DUAL;

DECODE(NULL,NULL,1)
-------------------
                  1
```

위 예시는 `DECODE` 함수 안에서는 두 NULL을 같은 값으로 비교할 수 있음을 보여줍니다.

NULL에 다른 비교 조건을 사용하면 결과는 `UNKNOWN`입니다. `UNKNOWN`은 대부분 `FALSE`처럼 처리됩니다. 예를 들어 `SELECT` 문의 `WHERE` 절에서 조건 결과가 `UNKNOWN`이면 해당 로우를 반환하지 않습니다.

하지만 `UNKNOWN`은 `FALSE`와 같지 않습니다. `UNKNOWN`에 다른 연산자를 적용해도 결과는 여전히 `UNKNOWN`일 수 있습니다.

```sql
NOT FALSE = TRUE
NOT UNKNOWN = UNKNOWN
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.tibero.com/tibero-manuals/7.2.6.manuals/tibero-sql-reference-guide/sql-elements/null.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
