---
title: DuckDB SQL
description: DuckDB SQL Reference
---

DuckDB provides a rich SQL dialect with powerful analytical capabilities. MotherDuck uses DuckDB's SQL engine, so all standard DuckDB syntax works seamlessly.

This reference covers core SQL statements, data types, functions, window functions, and query syntax. For MotherDuck-specific extensions like cloud database management and sharing, see the [MotherDuck SQL](/sql-reference/motherduck-sql-reference) reference.

:::tip
DuckDB maintains comprehensive documentation at [duckdb.org/docs](https://duckdb.org/docs/stable/). The reference here focuses on the most commonly used features.
:::

## Included pages

- [DuckDB statements](https://motherduck.com/docs/sql-reference/duckdb-sql-reference/duckdb-statements): DuckDB SQL statements reference
- [Query syntax](https://motherduck.com/docs/sql-reference/duckdb-sql-reference/query-syntax): DuckDB query syntax including SELECT, FROM, WHERE, GROUP BY, ORDER BY, and other clauses.
- [Data types](https://motherduck.com/docs/sql-reference/duckdb-sql-reference/data-types): Supported data types in DuckDB including numeric, string, date/time, and complex types.
- [Enum data type](https://motherduck.com/docs/sql-reference/duckdb-sql-reference/enum): DuckDB enum data type for defining columns with a fixed set of string values.
- [Expressions](https://motherduck.com/docs/sql-reference/duckdb-sql-reference/expressions): DuckDB expression syntax including operators, CASE, subqueries, and type casts.
- [Functions](https://motherduck.com/docs/sql-reference/duckdb-sql-reference/functions): Built-in scalar functions in DuckDB for string manipulation, math, dates, and more.
- [Aggregate functions](https://motherduck.com/docs/sql-reference/duckdb-sql-reference/aggregate-functions): DuckDB aggregate functions like SUM, COUNT, AVG, and statistical functions.
- [Window functions](https://motherduck.com/docs/sql-reference/duckdb-sql-reference/window-functions): DuckDB window functions for ranking, running totals, and analytical queries.
- [Configurations](https://motherduck.com/docs/sql-reference/duckdb-sql-reference/configurations): DuckDB configuration options for memory, threads, and query behavior.
- [Constraints](https://motherduck.com/docs/sql-reference/duckdb-sql-reference/constraints): Table constraints in DuckDB including PRIMARY KEY, UNIQUE, NOT NULL, and CHECK.
- [Information schema](https://motherduck.com/docs/sql-reference/duckdb-sql-reference/information-schema): DuckDB information_schema views for querying database metadata.
- [Metadata functions](https://motherduck.com/docs/sql-reference/duckdb-sql-reference/metadata-functions): DuckDB functions for querying table and column metadata programmatically.
- [PRAGMA statements](https://motherduck.com/docs/sql-reference/duckdb-sql-reference/pragma-statements): PRAGMA statements for DuckDB configuration and metadata queries.
- [SAMPLE](https://motherduck.com/docs/sql-reference/duckdb-sql-reference/sample): SAMPLE clause for retrieving random subsets of query results in DuckDB.


---

## Docs feedback

MotherDuck accepts optional user-submitted feedback about this page at `POST https://motherduck.com/docs/api/feedback/agent`.
For agents and automated tools, feedback submission should be user-confirmed before sending.

Payload:

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

`page_path` and `text` are required; `page_title` and `source` are optional. Responses: `200 {"feedback_id": "<uuid>"}`, `400` for malformed payloads, and `429` when rate-limited.
