DuckDB SQL
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 reference.
DuckDB maintains comprehensive documentation at duckdb.org/docs. The reference here focuses on the most commonly used features.
DuckDB SQL
19 items
Query syntax
DuckDB query syntax including SELECT, FROM, WHERE, GROUP BY, ORDER BY, and other clauses.
Data types
Supported data types in DuckDB including numeric, string, date/time, and complex types.
Enum data type
DuckDB enum data type for defining columns with a fixed set of string values.
Expressions
DuckDB expression syntax including operators, CASE, subqueries, and type casts.
Functions
Built-in scalar functions in DuckDB for string manipulation, math, dates, and more.
Aggregate functions
DuckDB aggregate functions like SUM, COUNT, AVG, and statistical functions.
Window functions
DuckDB window functions for ranking, running totals, and analytical queries.
Configurations
DuckDB configuration options for memory, threads, and query behavior.
Constraints
Table constraints in DuckDB including PRIMARY KEY, UNIQUE, NOT NULL, and CHECK.
Information schema
DuckDB information_schema views for querying database metadata.
Metadata functions
DuckDB functions for querying table and column metadata programmatically.
PRAGMA statements
PRAGMA statements for DuckDB configuration and metadata queries.
SAMPLE
SAMPLE clause for retrieving random subsets of query results in DuckDB.