SQL VALUES Generator

Runs in browser Database

Produce (v1, v2), (v3, v4) tuples from CSV/TSV data for multi-row INSERTs, MERGE sources and CTEs with proper escaping.

Privacy: This tool runs entirely in your browser. Your input never leaves your device.
Loading tool…

What is SQL, and why does the dialect matter?

SQL is the query language of relational databases, standardised in outline but implemented with dialect differences — quoting rules, functions, LIMIT versus TOP, date literals — by PostgreSQL, MySQL, SQLite, SQL Server and Oracle. A formatter normalises keywords, indentation and line breaks so a long query can be read and reviewed; a validator parses the statement to find syntax errors before it reaches the database.

Security note: Generated INSERT or IN-clause statements are for fixtures and migrations. In application code, values must go through parameterised queries — building SQL from user input by string concatenation is how SQL injection happens.

How to use SQL VALUES Generator

  1. Paste tabular data with a header row.
  2. Pick the output style and dialect.
  3. Copy the VALUES list or derived table.

SQL VALUES Generator features

  • CSV/TSV rows to (v1, v2), (v3, v4) tuples
  • Derived-table and CTE output with column aliases
  • INSERT statement output for quick seeding
  • Type-aware literals (numbers, booleans, NULL, quoted text)
  • Dialect-specific syntax: MySQL ROW(), Oracle SELECT … FROM DUAL

SQL VALUES Generator example

Derived table for a JOIN

Input:

sku,price
MT-100,89.9
MT-220,249

Output:

SELECT * FROM (
  VALUES
    ('MT-100', 89.9),
    ('MT-220', 249)
) AS v (sku, price)

Frequently asked questions about SQL VALUES Generator

What can I do with a VALUES list?

Use it as the body of a multi-row INSERT, as an inline table in a JOIN (SELECT * FROM (VALUES …) AS v(a, b)), as a MERGE source or as a CTE for testing queries without creating tables.

Which output styles exist?

Plain tuples, a derived table with column aliases, a CTE (WITH v AS …) and a full INSERT statement. MySQL uses ROW(…) syntax and Oracle uses SELECT … FROM DUAL with UNION ALL.

How are types inferred?

Each column is inspected: integers and decimals stay unquoted, booleans map to the dialect representation, empty or NULL cells become NULL and everything else is quoted text.

References

  • PostgreSQL Documentation: SQL SyntaxThe PostgreSQL Global Development GroupLexical structure of SQL in PostgreSQL: identifiers, quoting, string constants and escaping.
  • SQL As Understood By SQLiteSQLiteThe SQL grammar accepted by SQLite, statement by statement, with railroad diagrams.
  • SQL InjectionOWASP FoundationHow SQL injection works and why parameterised queries, not string building, are the defence.