Neatbo.

CSV to SQL DDL draft

Draft a quoted CREATE TABLE statement from CSV headers and review sample-based type suggestions without executing SQL.

Browser-local processingInputCSV + optional type mapOutputSQL DDL draft / JSON reviewUp to 1 MiB per file · File limit: 1
  1. 1Add input
  2. 2Adjust settings
  3. 3Get your result

Tool input and files are processed in this browser without being uploaded.

Your input

Inputs are kept temporarily in this tab when switching tools. Refreshing or closing clears them; large results may need to be regenerated.

⌘ / Ctrl + Enter to run

or drag and drop it here

Files stay on this device. Your originals stay unchanged.

.csv · .txt

Up to 1 MiB per file · File limit: 1

    0 characters · 0 bytes
    Options

    Complete the required options first. You can keep the defaults for the rest.

    Preparing the tool…

    Before you start

    Prepare a table definition before importing a CSV. Keep every column as text by default, then explicitly confirm a finite type map when the receiving database requires it.

    How to use this tool

    1. Paste or open CSV with headers, choose a dialect and set the table name.
    2. Review the default text columns and sample suggestions. If needed, enter a complete explicit column-type JSON map; otherwise keep TEXT.
    3. Download SQL and column-review.json. Confirm types and constraints in the receiving database before separately importing the data.

    Supported inputs and limits

    One UTF-8 CSV file or pasted input up to 1 MiB, at most 100 columns, 10,000 data records and 200,000 CSV cells including headers. A selected file takes precedence. Nonempty unique headers and table/column identifiers up to 128 code points are required; ASCII control characters are rejected.

    Defaults to nullable TEXT columns. Optional JSON must name every header exactly once, with {type,nullable?}; types are text, integer, decimal, boolean or date. Suggestions from nonblank sample values are displayed separately and never silently applied. Leading-zero identifiers stay text.

    SQLite uses INTEGER/NUMERIC, PostgreSQL uses BIGINT/NUMERIC, and MySQL uses BIGINT/DECIMAL(65,30) for selected integer/decimal types. Confirm range, precision, date rules and boolean semantics in your target. Table and column names are dialect-quoted; CSV values never appear in SQL.

    Output is a DDL draft only. No SQL is executed, no database is connected and no indexes, keys or import statements are inferred. Explicit types are not checked against every sample value; use field validation and the target database before importing. The column-review JSON records chosen types, confirmations and sample suggestions.

    Worked example

    Example input

    id,name
    01,Ada
    02,张三
    Example options
    {"params": {"tableName": "contacts", "dialect": "sqlite"}, "secondary": ""}

    Example output

    -- DDL draft: confirm column types and constraints in the receiving database.
    CREATE TABLE "contacts" (
      "id" TEXT,
      "name" TEXT
    );
    

    When something does not work

    Fix CSV quoting, unique headers and identifier control characters. A supplied type map must cover every column exactly and use the supported types with a boolean nullable flag. Confirm dialect-specific precision manually.

    Frequently asked questions

    Will it create a table in my database?

    No. It only generates local SQL text. You decide where and whether to execute a reviewed draft.

    Why are numeric-looking IDs still TEXT?

    Identifiers may have leading zeroes or exceed database ranges. Default text avoids using sample inference as an import contract.

    Does confirming a type validate the data?

    No. The map selects DDL types. Sample suggestions are limited evidence; use a field checker and the receiving database for validation.

    Documentation & further reading

    Related tools