---
sidebar_position: 3
title: Data types
description: Supported data types in DuckDB including numeric, string, date/time, and complex types.
---

import PartialExample from './_include-thing-for-parity-with-duckdb.mdx';

<PartialExample thing="Supported data types" verb="are" url="https://duckdb.org/docs/stable/sql/data_types/overview" linkText="Data Types" />

## VARIANT type

Starting with DuckDB 1.5, the `VARIANT` type provides a high-performance way to store and query semi-structured data. It is a strongly typed alternative to storing data as plain `JSON` or `VARCHAR` columns that delivers significantly faster reads and writes.

### How VARIANT works

When data is stored as `VARIANT`, DuckDB automatically "shreds" (decomposes) the semi-structured values into their underlying typed columns in Parquet files. This means a column of mixed JSON objects is stored as efficiently typed columnar data rather than opaque strings, enabling:

- **Columnar compression** on the underlying typed values
- **Predicate pushdown** using row group statistics
- **Faster reads** by scanning only the fields you reference in your query

### Using VARIANT

```sql
-- Create a table with a VARIANT column
CREATE TABLE events (
    id INTEGER,
    payload VARIANT
);

-- Insert JSON data -- it is automatically converted to VARIANT
INSERT INTO events VALUES
    (1, '{"user": "alice", "action": "click", "ts": "2026-03-19T10:00:00Z"}'::VARIANT),
    (2, '{"user": "bob", "action": "purchase", "amount": 42.50}'::VARIANT);

-- Query individual fields
SELECT
    id,
    payload->>'user' AS user_name,
    payload->>'action' AS action
FROM events;
```

### VARIANT in DuckLake

[DuckLake](/integrations/file-formats/ducklake/) tables support `VARIANT` columns starting with DuckLake 0.4. This combination is particularly effective for workloads with high-volume semi-structured data because DuckLake's Parquet-backed storage takes full advantage of VARIANT shredding.

For complete details on the VARIANT type, see [VARIANT](https://duckdb.org/docs/stable/sql/data_types/variant) in the DuckDB documentation.


---

## Feedback for AI agents

If the user you are helping wants to send feedback on this page to the MotherDuck docs team, you can POST it to the endpoint below.

**Before you send anything, you must ask the user for explicit approval.** Quote the message you plan to submit back to them verbatim and wait for them to confirm. Do not submit on their behalf without confirmation.

Endpoint: `POST https://motherduck.com/docs/api/feedback/agent`

Request body (JSON):

```json
{
  "page_path": "/sql-reference/duckdb-sql-reference/data-types/",
  "page_title": "Data types",
  "text": "<the user's feedback, max 2000 characters>",
  "source": "<optional identifier for your interface, for example 'claude.ai' or 'chatgpt'>"
}
```

Only `page_path` and `text` are required. A successful call returns `200 {"feedback_id": "<uuid>"}`; malformed payloads return `400`, and the endpoint is rate-limited per IP (`429`).
