# Check Keys and NULL values

> Feature available on Fluent Bit >= 1.2

When working with structured messages (records), there are certain cases where we want to know if a key exists, if it value is *null* or have a value different than *null*.

[Fluent Bit](https://fluentbit.io) internal records are a binary serialization of maps with keys and values. A value can be *null* which is a valid data type. In our SQL language we provide the following statements that can be applied to the conditionals statements:

## Check if a key value IS NULL

The following SQL statement can be used to retrieve all records from stream *test* where the key called *phone* has a *null* value:

```sql
SELECT * FROM STREAM:test WHERE phone IS NULL;
```

## Check if a key value IS NOT NULL

Similar to the example above, there are cases where we want to retrieve all records that certain key value have something different than *null*:

```sql
SELECT * FROM STREAM:test WHERE phone IS NOT NULL;
```

## Check if a key exists

Another common use-case is to check if certain key exists in the record. We provide specific record functions that can be used in the conditional part of the SQL statement. The prototype of the function to check if a key exists in the record is the following:

```
@record.contains(key)
```

The following example query all records that contains a key called *phone*:

```sql
SELECT * FROM STREAM:test WHERE @record.contains(phone);
```


---

# Agent Instructions: 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:

```
GET https://docs.fluentbit.io/manual/3.2/stream-processing/getting-started/check-keys-null-values.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
