ツール ガイド
Developer 無料 サインアップ不要

SQL Query Builder

Visual SQL query builder for SELECT, INSERT, UPDATE, DELETE

ツールを読み込み中…

このツールについて

Build SQL queries visually without memorising syntax. Enter a table name, add or remove columns, define WHERE conditions with field / operator / value rows, set ORDER BY and LIMIT clauses, and choose between SELECT, INSERT, UPDATE, and DELETE templates. The generated SQL is syntax-highlighted and ready to copy with a single click.

使い方

  1. 1 Select the query type (SELECT, INSERT, UPDATE, or DELETE) from the tabs.
  2. 2 Enter the table name.
  3. 3 Add the columns you want to include (for SELECT/UPDATE/INSERT).
  4. 4 Add WHERE conditions by clicking 'Add Condition' and filling in field, operator, and value.
  5. 5 Set ORDER BY column and LIMIT if needed, then copy the generated SQL.

What a query builder buys you

SQL is unforgiving about punctuation: a missing comma between columns, an unquoted string, or a stray AND at the start of a WHERE clause turns a valid statement into a syntax error. This builder removes that friction by assembling the statement for you from structured inputs — table name, columns, conditions — and rendering syntax-highlighted SQL you can copy straight into your database client. It runs entirely in your browser; it never connects to a database or executes anything, so it is a safe place to draft and learn queries without touching live data.

The four statement types and their anatomy

The tabs at the top switch between the four core data-manipulation statements. Each one uses the form fields differently:

TypeUses columnsUses valuesUses WHERE
SELECTYes (or * if none)NoOptional, plus ORDER BY / LIMIT
INSERTYes (column names)Yes (paired values)No
UPDATEYes (SET targets)Yes (new values)Optional but important
DELETENoNoOptional but critical

When you switch to SELECT and leave the column list empty, the builder emits SELECT *. For INSERT and UPDATE, each column row gains a second field for the value to write.

A worked example

Pick SELECT, set the table to orders, list the columns id, customer, and total, then add a WHERE condition total > 100 and a second one with logic AND, status = shipped. Set ORDER BY to total DESC and LIMIT to 10. The builder produces:

  • SELECT id, customer, total
  • FROM orders
  • WHERE total > 100
  •   AND status = 'shipped'
  • ORDER BY total DESC
  • LIMIT 10;

Notice two automatic decisions. The number 100 is left unquoted because it matches a numeric pattern, while shipped is wrapped in single quotes because it is text. And the first condition has no AND in front of it — the logic keyword only appears between conditions, never at the start. Getting both of those right by hand is exactly where beginners slip.

How values are quoted

The builder inspects each value and quotes it intelligently. A bare integer or decimal like 42 or 3.14 stays unquoted. Anything else becomes a single-quoted string, and any apostrophe inside your text is escaped so the surrounding quotes don't break. There is one deliberate special case: if your value already starts with ( and ends with ) — for example (1, 2, 3) — it is passed through untouched, which is what you want for an IN condition. So an IN condition with the value (10, 20, 30) produces field IN (10, 20, 30) rather than a quoted mess.

The most dangerous mistake, and how to avoid it

An UPDATE or DELETE without a WHERE clause affects every row in the table. The builder will happily generate DELETE FROM users; if you add no conditions — that statement erases the entire table. Always add at least one WHERE condition before running an UPDATE or DELETE against real data, and consider running the equivalent SELECT with the same WHERE first to preview exactly which rows will be touched. This builder is a drafting aid, not a safety net; review the generated SQL before executing it.

Practical tips

  • Use the WHERE operators fully. Beyond =, the operator dropdown includes LIKE for pattern matching, IN for sets, and IS NULL / IS NOT NULL — and when you pick a NULL operator the value field disappears, because those operators take no value.
  • Quote your LIKE wildcards correctly. Enter the value as %smith%; the builder quotes it for you, yielding name LIKE '%smith%'.
  • Dialect differences exist. The output uses standard SQL with single-quoted strings. Some databases prefer " for identifiers or use TOP instead of LIMIT (SQL Server). Adjust after copying if your engine differs.
  • Empty values become empty strings. A blank value field produces '', not NULL — use the IS NULL operator or edit the output if you truly mean NULL.
  • Copy, then test in a transaction. For destructive statements, wrap the copied SQL in a transaction so you can roll back if the row count surprises you.

A learning aid as much as a productivity tool

Beyond saving keystrokes, the syntax highlighting makes the structure of a statement visible: keywords in blue, string literals in green, numbers in amber. Watching the output update as you toggle between SELECT, INSERT, UPDATE, and DELETE is one of the fastest ways to internalize how the four statements share a vocabulary but arrange it differently — SELECT pulls columns out, INSERT pushes values in, UPDATE rewrites matched rows, and DELETE removes them. If you are new to SQL, build the same logical change as both a SELECT and an UPDATE side by side: read the rows first, confirm the WHERE clause is correct, and only then trust the version that modifies them.

よくある質問

{# Alpine.js — self-hosted. (The previous jsdelivr CDN tag had a stale SRI integrity hash, so the browser refused to run it and window.Alpine was never defined — silently breaking every FAQ accordion and Alpine tool.) #}