> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chowder.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# SQL data types

> Look up the SQL types Chowder supports and which ones `infer` can return.

Chowder uses SQL types for query expressions, source columns, and typed AI responses. Type keywords are case-insensitive. Accepted aliases have the same meaning: `BOOL` and `BOOLEAN`, for example, both describe a Boolean value.

## Primary types and aliases

Relation display and `DESCRIBE` use the canonical spelling. You can use the aliases below in SQL and in supported [`infer`](https://docs.chowder.ai/reference/column-functions/infer) output schemas.

| Canonical type | Accepted aliases | Meaning | `infer` output |
| - | - | - | - |
| `VARCHAR` | `TEXT`, `STRING` | UTF-8 text | Yes |
| `BOOLEAN` | `BOOL` | True or false | Yes |
| `INT` | `INTEGER` | Signed 32-bit integer | Yes |
| `BIGINT` | — | Signed 64-bit integer | Yes |
| `FLOAT` | `REAL` | 32-bit floating-point number | Yes |
| `DOUBLE` | — | 64-bit floating-point number | Yes |
| `BINARY` | `BYTEA` | Variable-length bytes, including encoded images | No; image input only |

`INT` and `FLOAT` retain their 32-bit widths in inference output. Use `BIGINT` or `DOUBLE` when you need the wider numeric type.

## Arrays and structs

| Type | Example | Meaning | `infer` output |
| - | - | - | - |
| `ARRAY<T>` | `ARRAY<VARCHAR>` | Variable-length array | Yes, for supported element types |
| `T[]` | `VARCHAR[]` | Alias for `ARRAY<T>` | Yes, for supported element types |
| `T[N]` | `FLOAT[3]` | Fixed-size array with exactly `N` elements | Yes, for supported element types |
| `STRUCT<name T, ...>` | `STRUCT<name VARCHAR, active BOOLEAN>` | Named fields, each with its own type | Yes, for supported field types |

Nest arrays and structs to describe your own output schema:

```chowder-sql theme={"theme":"css-variables","languages":{"custom":["/languages/chowder-sql.json"]}}
SELECT
    source,
    infer(
        image,
        'Describe this cup: its main color, material, and whether it has a handle.',
        STRUCT<
            color TEXT,
            material TEXT,
            has_handle BOOL
        > -- Define the structured output schema
    ).output AS product
FROM read_images('hf://buckets/chowderai/chowder-demo/image/data/amazon-products/drinking-cup/*.jpg')
LIMIT 3;
```

Access fields with dot notation, such as `product.color`. Unquoted field names normally fold to lowercase; use double quotes to preserve spelling, such as `STRUCT<"productName" TEXT>`.

For fixed-size arrays, use `T[N]`, rather than `ARRAY<T, N>`. When a fixed-size suffix follows adjacent nested closing brackets, separate the closing brackets: `STRUCT<tags ARRAY<VARCHAR> >[5]`.

## `ENUM` output

`ENUM` restricts an AI response to quoted string labels:

```chowder-sql theme={"theme":"css-variables","languages":{"custom":["/languages/chowder-sql.json"]}}
infer(content, 'Classify the sentiment.', ENUM('positive', 'negative', 'mixed'))
```

`ENUM` is an inference constraint, not a general-purpose `CAST` target. Its output is text, so relation display shows `VARCHAR`; the allowed labels remain part of the inference schema.

## Additional SQL types

These types are available in ordinary SQL and source schemas. They are not supported as `infer` output schemas.

| Type | Meaning |
| - | - |
| `TINYINT`, `SMALLINT` | Signed 8-bit and 16-bit integers |
| `TINYINT UNSIGNED`, `SMALLINT UNSIGNED`, `INT UNSIGNED`, `BIGINT UNSIGNED` | Unsigned 8-bit, 16-bit, 32-bit, and 64-bit integers |
| `FLOAT16` | 16-bit floating-point number |
| `DECIMAL(p, s)` | Exact decimal with precision `p` and scale `s`; `NUMERIC(p, s)` is an alias |
| `DATE` | Calendar date |
| `TIMESTAMP(p)` | Timestamp without a timezone |
| `TIMESTAMP_TZ(p, 'timezone')` | Timestamp with a timezone, such as `TIMESTAMP_TZ(6, 'UTC')` |
| `TIME(p)` | Time of day |
| `DURATION(unit)` | Duration in `SECOND`, `MILLISECOND`, `MICROSECOND`, or `NANOSECOND` units |
| `INTERVAL` | Calendar interval containing months, days, and nanoseconds |
| `INTERVAL YEAR TO MONTH`, `INTERVAL DAY TO SECOND` | Year-month and day-time intervals |
| `BINARY(N)` | Fixed-size binary value containing `N` bytes |
| `MAP(key_type, value_type)` | Key-value entries, such as `MAP(VARCHAR, BIGINT)` |
| `UNION(name type, ...)` | Value drawn from named alternative types |
| `NULL` | Null-only type |

For `TIME` and `TIMESTAMP`, precision `0`, `3`, `6`, or `9` represents seconds, milliseconds, microseconds, or nanoseconds.

```chowder-sql theme={"theme":"css-variables","languages":{"custom":["/languages/chowder-sql.json"]}}
SELECT
    CAST('19.95' AS DECIMAL(12, 2)) AS amount,
    CAST('2026-01-01' AS DATE) AS invoice_date,
    CAST(NULL AS FLOAT[3]) AS embedding;
```

Encoded images use `BINARY`; there is no separate `IMAGE` SQL type. A fixed-size vector uses `FLOAT[N]`, not `BINARY(N)`. The `output` field returned by [`embed`](https://docs.chowder.ai/reference/column-functions/embed) is a fixed-size `FLOAT[N]` array whose width comes from the selected model.

## Inspect types

Use `DESCRIBE` or relation display to inspect canonical SQL names. `Relation.schema` exposes the exact Arrow schema, including storage variants and nullability. For example, Arrow string variants such as `Utf8`, `LargeUtf8`, and `Utf8View` all display as `VARCHAR`.

Arrow diagnostic functions such as `arrow_typeof` and `arrow_cast` use Arrow's type vocabulary rather than these canonical SQL names. Some Arrow types, including intervals and unions, may not convert directly to every dataframe library; use [`to_arrow_table()`](https://docs.chowder.ai/reference/python-api) to preserve those types.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.