---
sidebar_position: 3
title: MD_CREATE_DIVE
description: Create a new Dive in your MotherDuck account.
feature_stage: preview
---

Creates a new [Dive](/key-tasks/ai-and-motherduck/dives) in your MotherDuck account. Returns the created Dive's metadata and initial version information.

## Syntax

```sql
SELECT * FROM MD_CREATE_DIVE(
  title ='My Dive',
  content ='<JSX component code>',
  description ='A brief description',
  api_version =1
);
```

## Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `title` | `VARCHAR` | Yes | The title of the Dive |
| `content` | `VARCHAR` | Yes | The JSX/React component code |
| `description` | `VARCHAR` | No | A brief description of the Dive |
| `api_version` | `UINTEGER` | No | API version for the Dive format. Defaults to `1`. |

## Return Columns

| Column | Type | Description |
|--------|------|-------------|
| `id` | `UUID` | Unique identifier of the created Dive |
| `title` | `VARCHAR` | Dive title |
| `description` | `VARCHAR` | Dive description |
| `owner_id` | `UUID` | UUID of the Dive owner |
| `current_version` | `INTEGER` | Version number (1 for newly created Dives) |
| `created_at` | `TIMESTAMP WITH TIME ZONE` | When the Dive was created |
| `updated_at` | `TIMESTAMP WITH TIME ZONE` | When the Dive was last updated |
| `owner_name` | `VARCHAR` | Name of the Dive owner |
| `version_id` | `UUID` | UUID of the initial version |
| `version_storage_url` | `VARCHAR` | Storage URL of the version content |
| `version_description` | `VARCHAR` | Description for this version |
| `version_created_at` | `TIMESTAMP WITH TIME ZONE` | When this version was created |
| `version_api_version` | `UINTEGER` | API version used |

## Examples

Create a Dive with title and content:

```sql
SELECT id, title, current_version
FROM MD_CREATE_DIVE(
  title ='Revenue Trends',
  content ='import { useSQLQuery } from "@motherduck/react-sql-query";
export default function Dive() {
  const { data } = useSQLQuery(`SELECT * FROM sales`);
  return <div>{JSON.stringify(data)}</div>;
}'
);
```

Create a Dive with a description:

```sql
SELECT *
FROM MD_CREATE_DIVE(
  title ='Monthly Revenue',
  description ='Line chart of revenue by month',
  content ='<component code>'
);
```

## Related

- [`MD_UPDATE_DIVE_CONTENT`](../md-update-dive-content) — Update a Dive's content (creates a new version)
- [`MD_UPDATE_DIVE_METADATA`](../md-update-dive-metadata) — Update a Dive's title or description
- [`save_dive` MCP tool](/sql-reference/mcp/save-dive) — AI assistant equivalent
