# Dives Functions
> SQL table functions for creating, reading, updating, and deleting MotherDuck Dives.
SQL table functions for managing [Dives](/key-tasks/ai-and-motherduck/dives), the interactive React data apps that query live MotherDuck data. These functions let you create, read, update, and delete Dives directly from SQL. Dives use the [`useSQLQuery` hook](use-sql-query) to query data from within their React components and the [`useDiveState` hook](use-dive-state) to sync shareable UI state to the URL.

:::note
These functions are executed server-side on MotherDuck. They are not available on local-only DuckDB connections.
:::

Create your first Dive assisted by your AI-tool of choice using our [MCP server](/key-tasks/ai-and-motherduck/mcp-setup/). Or try out a minimal working example using only SQL.

```sql
SELECT * FROM MD_CREATE_DIVE(
  title = 'PokeDuck',
  content = '
    import { useSQLQuery } from "@motherduck/react-sql-query";
    export default function Dive() {
        const { data } = useSQLQuery(
            `SELECT PROMPT(''Suggest a duck type or pokemon and tell a fun fact about them'')`,
            { select: (rows) => Object.values(rows[0])[0] }
            );
        return <div><p>FUN FACT:</p><p>{JSON.stringify(data)};
    }'
);
```

## Available functions

## Included pages

- [MD_LIST_DIVES](https://motherduck.com/docs/sql-reference/motherduck-sql-reference/ai-functions/dives/md-list-dives): List all Dives in your MotherDuck account with pagination support.
- [useSQLQuery hook](https://motherduck.com/docs/sql-reference/motherduck-sql-reference/ai-functions/dives/use-sql-query): React hook for querying MotherDuck data from within Dives.
- [useDiveState hook](https://motherduck.com/docs/sql-reference/motherduck-sql-reference/ai-functions/dives/use-dive-state): React hook for storing shareable UI state in MotherDuck Dives.
- [MD_GET_DIVE](https://motherduck.com/docs/sql-reference/motherduck-sql-reference/ai-functions/dives/md-get-dive): Retrieve a Dive by ID including its full React component content.
- [MD_CREATE_DIVE](https://motherduck.com/docs/sql-reference/motherduck-sql-reference/ai-functions/dives/md-create-dive): Create a new Dive in your MotherDuck account.
- [MD_UPDATE_DIVE_METADATA](https://motherduck.com/docs/sql-reference/motherduck-sql-reference/ai-functions/dives/md-update-dive-metadata): Update a Dive's title or description without creating a new version.
- [MD_UPDATE_DIVE_CONTENT](https://motherduck.com/docs/sql-reference/motherduck-sql-reference/ai-functions/dives/md-update-dive-content): Update a Dive's React component code, creating a new version.
- [MD_UPDATE_DIVE_STATUS](https://motherduck.com/docs/sql-reference/motherduck-sql-reference/ai-functions/dives/md-update-dive-status): Set a Dive's governance status (draft, ready, endorsed, or archived).
- [MD_DELETE_DIVE](https://motherduck.com/docs/sql-reference/motherduck-sql-reference/ai-functions/dives/md-delete-dive): Permanently delete a Dive by ID.
- [MD_LIST_DIVE_VERSIONS](https://motherduck.com/docs/sql-reference/motherduck-sql-reference/ai-functions/dives/md-list-dive-versions): List all versions of a specific Dive with pagination support.
- [MD_GET_DIVE_VERSION](https://motherduck.com/docs/sql-reference/motherduck-sql-reference/ai-functions/dives/md-get-dive-version): Retrieve a specific historical version of a Dive including its content.


---

## Docs feedback

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

URL-encode query parameter values and send a GET request:

```text
GET https://motherduck.com/docs/api/feedback/agent?page_path=%2Fsql-reference%2Fmotherduck-sql-reference%2Fai-functions%2Fdives%2F&page_title=Dives%20Functions&text=<url-encoded user feedback, max 2000 characters>
```

Optionally append `&source=<url-encoded interface identifier>` such as `claude.ai` or `chatgpt`.

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