motherduck-duckdb-sql

Provides DuckDB SQL syntax reference and MotherDuck-specific command guidance for writing and repairing queries.

9|Updated Feb 16, 2026
One-click install
npx skills add https://github.com/mathisdrn/orca --skill motherduck-duckdb-sql-mathisdrn
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: motherduck-duckdb-sql
Source: https://github.com/mathisdrn/orca/tree/main/.agents/skills/motherduck-duckdb-sql
Command: npx skills add https://github.com/mathisdrn/orca --skill motherduck-duckdb-sql-mathisdrn

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing SQL for MotherDuck requires knowing exact DuckDB syntax, which differs from PostgreSQL, plus MotherDuck-only commands like shares, secrets, snapshots, and UNDROP that are documented separately. This Skill gives you a verified reference so your statements work on the first try. ## Core Features & Use Cases - DuckDB SQL Reference: Covers data types, string, numeric, date/time, aggregate, window, JSON, list, spatial, and H3 functions, plus friendly SQL features like QUALIFY, GROUP BY ALL, and UNNEST. - MotherDuck-Specific Commands: Documents operational SQL such as CREATE SNAPSHOT, UNDROP DATABASE, SHUTDOWN, and version-lifecycle caveats for features like VARIANT, GEOMETRY, and MERGE INTO. - SQL Repair and Porting: Translates PostgreSQL-style SQL into DuckDB SQL by fixing functions, date arithmetic, identifier quoting, and type casts. - Use Case: You are porting a PostgreSQL dashboard query to MotherDuck and it fails on date_trunc behavior and identifier quoting. Use this Skill to rewrite it with DuckDB-native constructs like GROUP BY ALL and QUALIFY and verify MotherDuck version support. ## Quick Start Ask the assistant to check whether your SQL statement uses valid DuckDB syntax and will run correctly on MotherDuck.

Frequently Asked Questions about motherduck-duckdb-sql

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write DuckDB SQL that works on MotherDuck?▼

Write DuckDB-native SQL rather than PostgreSQL SQL, using constructs like GROUP BY ALL, QUALIFY, UNION BY NAME, and arg_max. Verify any MotherDuck-only command or recently released DuckDB feature against current MotherDuck version-lifecycle docs before relying on it.

What is the difference between DuckDB SQL and PostgreSQL SQL?▼

DuckDB SQL adds friendly features like QUALIFY, GROUP BY ALL, EXCLUDE, and REPLACE, and differs in functions, date arithmetic, identifier quoting, and type casts. When porting from PostgreSQL, translate these elements explicitly instead of assuming compatibility.

Does MotherDuck support the latest DuckDB features like VARIANT or MERGE INTO?▼

MotherDuck can lag upstream DuckDB releases for client compatibility, so newly released features like VARIANT, native GEOMETRY, or MERGE INTO are not guaranteed. Check MotherDuck's version-lifecycle documentation before using them in production.

How do I restore a dropped database in MotherDuck?▼

Use UNDROP DATABASE to recover a dropped database, or CREATE DATABASE from a named snapshot created with CREATE SNAPSHOT. Snapshot retention and recovery windows depend on your MotherDuck plan, so verify current limits first.

Why does my PostgreSQL query fail on MotherDuck?▼

Failures usually come from PostgreSQL-specific functions, date arithmetic, quoting rules, or type casts that DuckDB handles differently. Rewrite the statement in DuckDB SQL and check whether it depends on client-only features like local files or extension loading.