> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chartdb.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Export Diagram as SQL

> Generate SQL scripts from your ChartDB diagrams to quickly deploy your database schema.

<Frame>
  <img src="https://mintcdn.com/buckledev/Nk8pE0k5UNFAdU1u/docs/images/export-sql.png?fit=max&auto=format&n=Nk8pE0k5UNFAdU1u&q=85&s=53d3f43eb3ef20b2d6ea41e19a490175" width="2874" height="1798" data-path="docs/images/export-sql.png" />
</Frame>

<Note>
  The SQL scripts generated by ChartDB are **schema definitions based on your
  diagram**. They are intended to help you create the structure in your
  database. **These scripts are not meant for data migration or direct execution
  on production databases without review.**
</Note>

<Steps>
  <Step title="Access Export SQL">
    Navigate to the **File** menu in the top navigation bar and hover over **Export SQL**.
  </Step>

  <Step title="Choose SQL Flavor">
    Select your preferred SQL dialect from the submenu:

    <ul>
      <li><b>Generic SQL:</b>  Provides standard SQL compatible across most database systems.</li>
      <li><b>PostgreSQL, MySQL, SQL Server, MariaDB, SQLite:</b> Generates SQL tailored to specific database systems.</li>
    </ul>

    <Note>
      PostgreSQL, MySQL, SQL Server, MariaDB, and SQLite exports are available **exclusively for signed-in users**. Generic SQL export is available for all users.
    </Note>
  </Step>

  <Step title="Copy SQL Script">
    A modal window will appear displaying the generated SQL script in a text area. Click the **Copy** button to copy the script to your clipboard.
  </Step>
</Steps>
