JSONからSQL CREATE TABLE・DDLを生成

JSONサンプルをPostgreSQL、MySQL、SQLite、SQL Server、Oracle向けのDDL案に変換します。

// about

ツールについて

JSONのフィールドと型を推測してDDLの下書きを作成します。入れ子の値はJSONまたはテキストとして扱われるため、本番利用前に必ず確認してください。

使い方

  1. 代表的なJSONオブジェクトを貼り付けます。
  2. データベースとテーブル名を選びます。
  3. 生成後に型、制約、インデックス、リレーションを確認します。

このツールが使われる理由

  • JSONサンプルからSQLテーブル定義の下書きを作成できます。
  • PostgreSQL、MySQL、SQLite、SQL Server、Oracleを選択できます。
  • 列とデータ型を検討する出発点として使えます。

よくある質問 (FAQ)

完全なスキーマを設計できますか?

いいえ。1つのJSONからテーブル案を作ります。本番ではキー、制約、インデックス、関連、マイグレーションを追加してください。

ガイド · データ · 3分で読めます

UUIDガイド:v4とv7の違い、データベースの主キーにUUIDを使うときのポイント

550e8400-e29b-41d4-a716-446655440000 のような文字列は、注文、ファイル、APIリクエストなどあらゆる場所で識別子として使われています。UUIDがどのように生成されるのか、どのバージョンを選ぶべきかを学びましょう。

UUID(Universally Unique Identifier)は128ビットの識別子で、中央のサーバーに問い合わせなくても、誰もが重複しないIDを作れるようにするものです。MicrosoftではGUIDと呼ばれます。現在の標準は2024年に公開されたRFC 9562です。

UUIDの構造、バージョンごとの違い、衝突が事実上起きない理由、そして主キーとしてv4よりv7が注目される理由を解説します。
ガイドを読む →
AIで作る

このツールをAIで自作してみましょう

自分用のバージョンが必要なら、作業指示プロンプトをAIチャットに貼り付けるか、スキルファイルをAIコーディングエージェントに保存してください。私たちが開発時に整理した機能、例外、テストケースが含まれています。

プロンプトとスキルは英語で提供しています。AIツールはどの言語でもよく理解できます。

AI作業指示プロンプト

Claude、ChatGPT、GeminiなどのAIチャットにそのまま貼り付けてください。

You are an experienced full-stack web developer. Build a web tool called "JSON DDL生成ツール" 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.md)

Claude CodeなどのAIコーディングエージェントで .claude/skills/build-json-ddl-generator/SKILL.md に保存すると、このツールを作る・直すたびに再利用できます。

---
name: build-json-ddl-generator
description: Use when building or changing a JSON DDL生成ツール tool. Build a tool that generates database CREATE TABLE statements from a JSON sample.
---

# Build: JSON DDL生成ツール

## 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

AIに任せるときのコツ

  • 最初の行に使用技術(React、Vue、素のHTMLなど)を書くと、プロジェクトに合ったコードになります。
  • コードを受け取る前に、テストケースを実行して結果を見せるよう依頼しましょう。
  • 本物のパスワード、顧客データ、APIキーは入力せず、サンプル値を使ってください。