---
sidebar_position: 0
title: Dives Functions
description: SQL table functions for creating, reading, updating, and deleting MotherDuck Dives.
feature_stage: preview
---

import DocCardList from '@theme/DocCardList';

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.

:::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)}</p></div>;
    }'
);
```


## Available functions

<DocCardList />
