Saltar al contenido
Visualización

SQL a Diagrama ER

Analice sentencias CREATE TABLE y genere automáticamente diagramas ER en formato Mermaid. Visualice de forma segura su diseño de base de datos íntegramente en el navegador.

Guía: How to use & features

  • Enter or paste SQL `CREATE TABLE` statements into the text area.
  • Click the "Visualize" button to generate and display the ER diagram using Mermaid syntax.
  • Table relationships (Foreign Keys) are automatically extracted from `FOREIGN KEY` or `REFERENCES` clauses.
  • Use the "Copy Mermaid Code" button to save the generated syntax to your clipboard.
  • Your schema data is processed entirely in the browser, ensuring privacy and security.

Ejemplos: Examples

Users and Posts (One-to-Many)

Entrada

CREATE TABLE users (
  id INT PRIMARY KEY,
  name VARCHAR(50)
);

CREATE TABLE posts (
  id INT PRIMARY KEY,
  user_id INT REFERENCES users(id),
  title VARCHAR(100)
);

Salida

erDiagram
    users {
        INT id PK
        VARCHAR(50) name
    }
    posts {
        INT id PK
        INT user_id
        VARCHAR(100) title
    }

    posts }|--|| users : "user_id -> id"

FAQ: FAQ

  • Does it support all SQL dialects?

    It supports standard SQL CREATE TABLE syntax. Some highly specific proprietary vendor extensions may not be fully parsed as it uses a custom regex-based parser.
  • Is my data sent to a server?

    No. All processing is done locally in your browser via JavaScript. Your SQL code never leaves your computer.
  • What if relationships are not showing up?

    Ensure that your statements include FOREIGN KEY or REFERENCES clauses. The tool relies on these constraints to identify and draw relationships.

Casos de uso: Common Use Cases

  • Database Documentation

    Quickly visualize and document existing table structures by pasting SQL exports.

  • Schema Design Verification

    Self-check your DDL to ensure that relationships and constraints are correctly defined during the design phase.

  • Team Collaboration

    Share specific sub-system structures with your team using lightweight Mermaid syntax before generating full documentation.

Notas: Notes & Limitations

  • Limited SQL Syntax

    Statements other than CREATE TABLE (e.g., stored procedures, triggers, complex INDEX definitions) are ignored.

  • Performance with Large Schemas

    Very large schemas with dozens of tables may significantly impact browser rendering performance.

  • Syntax Errors

    Incomplete or malformed SQL statements (missing parentheses, typos) will result in parsing failures.

erDiagram USERS ||--o{ POSTS : "user_id -> id" USERS { int id PK string name } POSTS { int id PK int user_id string title }

SQL a diagrama ER

Convierte definiciones SQL, como CREATE TABLE, en diagramas ER para visualizar tablas, columnas y relaciones. Es útil para entender esquemas existentes o documentar bases de datos.

Casos de uso

  • Leer esquemas heredados: convierte SQL en una vista visual.
  • Documentar bases de datos: genera diagramas para guías o revisiones.
  • Revisar relaciones: identifica claves y conexiones entre tablas.

El diagrama depende de la información presente en el SQL. Revisa manualmente relaciones implícitas o reglas de negocio no declaradas.