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
- Dives: Create and manage interactive data visualizations
For standard SQL operations, see the DuckDB Syntax reference.
AI
4 items
ALTER DATABASE SET SNAPSHOT
Restore a database from a snapshot using ALTER DATABASE SET SNAPSHOT TO.
ALTER DATABASE
Update storage-related settings on a MotherDuck database.
ALTER SNAPSHOT
Rename or remove names from database snapshots using ALTER SNAPSHOT.
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 snapshot of a MotherDuck database for recovery or read scaling.
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.
UNDROP DATABASE
Restore a dropped MotherDuck database within its snapshot retention window.
UPDATE SHARE
Manually update a share with a new database snapshot.
Server Connection Management
3 items
MD_INFORMATION_SCHEMA
8 items