Generador SQL CREATE TABLE y DDL desde JSON

Convierte un ejemplo JSON en un borrador DDL para PostgreSQL, MySQL, SQLite, SQL Server u Oracle.

// about

Sobre esta herramienta

La herramienta infiere columnas y tipos SQL desde un objeto JSON. Los valores anidados se representan como JSON o texto; revisa siempre el script antes de producción.

Cómo usarla

  1. Pega un objeto JSON representativo.
  2. Selecciona la base de datos y escribe el nombre de la tabla.
  3. Genera el DDL y revisa tipos, restricciones, índices y relaciones.

Por qué usar esta herramienta

  • Convierte rápidamente un ejemplo JSON en una definición de tabla SQL.
  • Elige PostgreSQL, MySQL, SQLite, SQL Server u Oracle.
  • Usa el resultado como punto de partida para revisar columnas y tipos.

Preguntas frecuentes (FAQ)

¿Diseña un esquema completo?

No. Crea un borrador desde un ejemplo JSON. Añade claves, restricciones, índices, relaciones y migraciones para tu aplicación.

Guías · Datos · 7 min de lectura

Guía de UUID: v4 frente a v7 y UUID como claves primarias

Cadenas como 550e8400-e29b-41d4-a716-446655440000 identifican pedidos, archivos y peticiones de API en todas partes. Aprende cómo se generan los UUID y qué versión elegir.

Un UUID (Universally Unique Identifier) es un identificador de 128 bits que permite a cualquiera crear ID que no choquen sin consultar a un servidor central. Microsoft lo llama GUID. El estándar actual es la RFC 9562, publicada en 2024.

Estructura de un UUID, diferencias entre versiones, por qué no colisionan en la práctica y por qué UUID v7 supera a v4 como clave primaria.
Leer guía →
Créalo con IA

Crea esta herramienta tú mismo con IA

¿Quieres tu propia versión? Copia el prompt en un chat de IA o guarda el archivo de skill para un agente de programación. Incluyen las funciones, casos límite y pruebas que usamos al crearla.

El prompt y la skill están en inglés, que las herramientas de IA entienden perfectamente.

Prompt de instrucciones para IA

Pégalo tal cual en Claude, ChatGPT o Gemini.

You are an experienced full-stack web developer. Build a web tool called "Generador de DDL desde JSON" that meets the requirements below.

## Goal

Build a tool that generates database CREATE TABLE statements from a JSON sample.

## Core features

- Choose MySQL, PostgreSQL, SQL Server or Oracle
- Infer column types from values
- Choose a primary key
- Option to map nested objects and arrays to child tables or JSON columns
- Copy result

## Inputs

- A JSON object or array of objects
- Database, table name, primary key

## Outputs

- CREATE TABLE SQL
- Reason for each inferred type

## Edge cases and handling rules

- Pick the widest type across rows (int + decimal → DECIMAL)
- Infer date/time types from ISO 8601 strings
- Allow NULL where null values appear
- Respect each database's identifier quoting and reserved words

## Implementation requirements

- Build it as a single page (HTML, CSS, JavaScript) that runs entirely in the browser, and never send the user's input to a server.
- Make the UI responsive and easy to use on mobile; label every input and keep everything keyboard accessible.
- Add a Copy button for results and show clear, friendly error messages for invalid input.
- Keep the core logic in functions separate from the UI so it can be unit-tested.

## Definition of done (test cases)

- {"id":1,"price":9.9,"createdAt":"2026-10-28T09:00:00Z"} gives integer, decimal and timestamp types
- PostgreSQL output uses double-quoted identifiers
- PRIMARY KEY appears when a key is chosen

First outline your implementation plan in at most five lines, then write the complete code, and finally explain how to check the test cases above.

Skill (SKILL.md)

Guárdalo como .claude/skills/build-json-ddl-generator/SKILL.md para que agentes como Claude Code lo reutilicen cada vez que crees o cambies la herramienta.

---
name: build-json-ddl-generator
description: Use when building or changing a Generador de DDL desde JSON tool. Build a tool that generates database CREATE TABLE statements from a JSON sample.
---

# Build: Generador de DDL desde JSON

## Goal

Build a tool that generates database CREATE TABLE statements from a JSON sample.

## Workflow

1. Review the required features, inputs and outputs below and ask about anything missing first.
2. Implement the core logic as pure functions separate from the UI.
3. Check the logic against the test cases in the verification list.
4. Build a responsive UI with an input form, a result area and a Copy button.
5. Reproduce each edge case listed under Rules and refine the error messages.

## Core features

- Choose MySQL, PostgreSQL, SQL Server or Oracle
- Infer column types from values
- Choose a primary key
- Option to map nested objects and arrays to child tables or JSON columns
- Copy result

## Inputs

- A JSON object or array of objects
- Database, table name, primary key

## Outputs

- CREATE TABLE SQL
- Reason for each inferred type

## Rules

- Pick the widest type across rows (int + decimal → DECIMAL)
- Infer date/time types from ISO 8601 strings
- Allow NULL where null values appear
- Respect each database's identifier quoting and reserved words
- Build it as a single page (HTML, CSS, JavaScript) that runs entirely in the browser, and never send the user's input to a server.

## Verification

- [ ] {"id":1,"price":9.9,"createdAt":"2026-10-28T09:00:00Z"} gives integer, decimal and timestamp types
- [ ] PostgreSQL output uses double-quoted identifiers
- [ ] PRIMARY KEY appears when a key is chosen

Consejos para trabajar con IA

  • Indica tu stack (React, Vue o HTML puro) en la primera línea para obtener código adecuado.
  • Pide que ejecute las pruebas listadas y muestre los resultados antes de aceptar el código.
  • No pegues contraseñas reales, datos de clientes ni claves de API; usa valores de ejemplo.