MotherDuck SQL
MotherDuck extends DuckDB with cloud-native SQL capabilities for managing databases, shares, secrets, and connections. These statements let you work with MotherDuck's serverless infrastructure directly from SQL.
Key capabilities:
- Database management: Create, copy, attach, and drop cloud databases
- Data sharing: Share data with other users and organizations
- Secrets management: Store and manage credentials securely
- AI functions: Generate embeddings, run prompts, and get SQL assistance
For standard SQL operations, see the DuckDB Syntax reference.
AI
3 items
ATTACH
Attach local databases, MotherDuck databases, or public shares to your session
COPY FROM DATABASE (OVERWRITE)
Overwrite a database with a zero-copy clone from another database.
COPY FROM DATABASE
Copy a database from one location to another in MotherDuck
CREATE DATABASE
Create a database, zero-copy clone from an existing database, or import a local DuckDB file into MotherDuck.
CREATE SECRET
Create a secret in MotherDuck
CREATE SHARE
Create a share from a database to share data with other users
CREATE SNAPSHOT
Create a read-only snapshot for read-scaling Ducklings.
DROP SECRET
Delete a secret from MotherDuck or local storage.
DESCRIBE SHARE
Get details about a specific share by name or URL.
DETACH
Detach local, remote, or shared databases from your session
DROP DATABASE
Remove a database from MotherDuck.
DROP SHARE
Delete a share and revoke access for all attached users.
EXPLAIN ANALYZE
Execute a query and display performance metrics for each operator.
EXPLAIN
Display the physical query plan without executing the query.
GRANT READ ON SHARE
Give users access to a restricted share.
LIST SECRETS
List all secrets stored in memory and MotherDuck.
LIST SHARES
List all shares created by the current user.
MD_RUN parameter
Control whether table functions run locally or remotely.
PRINT_MD_TOKEN pragma
Retrieve your MotherDuck authentication token.
REFRESH DATABASE
Sync databases with the latest snapshot or share updates.
REVOKE READ ON SHARE
Remove user access from a restricted share.
SHOW ALL DATABASES
List all MotherDuck, DuckDB, and shared databases.
TEMPORARY TABLES
Create local temporary tables for session-scoped data.
UPDATE SHARE
Manually update a share with a new database snapshot.
Server Connection Management
3 items
MD_INFORMATION_SCHEMA
7 items