Skip to content
Visual Editor

Visual SQL Query Builder

A visual builder for SQL SELECT statements. Add tables and columns, connect them with JOIN (JOIN, LEFT, RIGHT, FULL), add WHERE conditions (comparisons, LIKE, IN, IS NULL and subqueries), and summarize with COUNT, SUM, AVG, MIN and MAX, GROUP BY, HAVING, ORDER BY, LIMIT / OFFSET and DISTINCT. The SQL is rewritten as you edit, and you can paste CREATE TABLE statements to start from your own schema and its real column names. The output is standard LIMIT-style SQL suited to MySQL, PostgreSQL and SQLite (FULL JOIN is not available on MySQL). It builds SELECT statements only, with AND / OR, BETWEEN, EXISTS, UNION / UNION ALL, WITH (CTEs), subqueries in FROM and window functions (ROW_NUMBER, RANK, aggregates, LAG and LEAD) supported. Everything runs in your browser, and table names and schemas are never sent to a server.

Query Configuration

Tables and filters

Aggregation and sorting

The query you are building is saved automatically in this browser (nothing is sent to a server), so you can pick up where you left off. “Clear” returns to the starting query.

Parameterize the SQL

Replaces the constants in the generated SQL with placeholders and lists the values separately, so you can use it with a prepared statement.

Change data (INSERT / UPDATE / DELETE)

Build statements that add, update or delete rows, using the tables and columns from the query above. Values are quoted automatically. NULL, TRUE, FALSE and NOW() are kept as keywords (wrap a value in quotes to get the string 'NULL').

Join another table (optional)

When you enter a table, PostgreSQL and SQLite use FROM / USING and MySQL uses JOIN. A value written as table.column is treated as a column reference (e.g. o2.status).

WHERE (target rows)

Your input is saved automatically in this browser (nothing is sent to a server).

Guide

How to use & features

  • Click "Add Table" to specify table names and columns to select.
  • Use "Add Join" to configure relationships (JOIN) between multiple tables.
  • Click "Add Condition" to visually add WHERE clauses. It automatically handles string quotes.
  • SQL is generated in real-time in the textarea below as you make changes.
  • Use "Add Aggregate" for COUNT, SUM, AVG, MIN or MAX and "Add GROUP BY" for grouping columns. Non-aggregated selected columns are added to GROUP BY automatically.
  • "Add HAVING", "Add ORDER BY", DISTINCT, LIMIT and OFFSET are supported as well.
  • Tick "Subquery (SELECT)" on a condition row to build IN (SELECT …) or > (SELECT AVG(…) …).
  • Save the generated SQL to your clipboard using the "Copy" button.
  • The "Clear" button resets everything back to the default state.
Samples

Sample input & output

Simple SELECT Query

Input
Table: users, Columns: id, name, WHERE: id = 1
Output
SELECT users.id, users.name FROM users WHERE users.id = 1;
FAQ

Frequently Asked Questions

  • Can I join multiple tables?

    Yes, you can generate JOIN clauses and link multiple tables using the "Add Join" button.
  • Does it support complex subqueries?

    Besides SELECT, JOIN and WHERE, it supports aggregate functions, GROUP BY, HAVING, ORDER BY, LIMIT/OFFSET and DISTINCT. Each WHERE condition can be joined with AND or OR (AND binds tighter than OR, so conditions joined by AND are wrapped in parentheses in the output), and BETWEEN is supported. Tick "Subquery" to use IN (SELECT …) or a comparison such as > (SELECT AVG(…) …), and choose EXISTS / NOT EXISTS as the operator for a correlated subquery that refers to the outer table. The tabs at the top let you add WITH (CTE) queries and queries joined with UNION / UNION ALL (set the ORDER BY, LIMIT and OFFSET for the whole UNION on the main query). A subquery made with "Add FROM subquery" becomes FROM (SELECT …) AS name when you use its name as the main table. "Add window function" gives ROW_NUMBER, RANK, DENSE_RANK, SUM, AVG, COUNT, MIN, MAX, LAG and LEAD with PARTITION BY / ORDER BY. INSERT / UPDATE / DELETE are built in the "Change data" section further down, using the tables and columns of the query (multi-row INSERT, upsert and INSERT … SELECT are supported). Stored procedures cannot be built, so adjust the generated SQL by hand for those.
  • Can I build GROUP BY queries with COUNT or SUM?

    Yes. Use "Add Aggregate" to pick COUNT, SUM, AVG, MIN or MAX, and "Add GROUP BY" to choose the grouping columns. Selected columns that are not aggregated are added to GROUP BY automatically so the query does not fail. Filter the aggregated rows with "Add HAVING", sort with "Add ORDER BY", and cap the result with the LIMIT/OFFSET fields.
  • Do I need to connect a database beforehand?

    No, this tool is an editor for building SQL strings and does not connect to any actual database. It runs entirely in your browser for maximum security.
  • Which SQL dialect is supported?

    It outputs standard ANSI SQL without dialect-specific quoting, so the same query runs on MySQL, PostgreSQL, SQLite and SQL Server. The one exception is FULL JOIN: MySQL does not support it, and SQLite supports it only from version 3.39.
  • Can I use it as a MySQL query builder?

    Yes. Choose INNER JOIN, LEFT JOIN or RIGHT JOIN (not FULL JOIN), and the output runs on MySQL as is. If a table or column name is a reserved word such as order or group, wrap it in backticks (MySQL) or double quotes (PostgreSQL) after copying, because the builder does not quote identifiers.
  • Can I load my table definitions instead of typing them?

    Yes. Click "Import from DDL" and paste CREATE TABLE statements, for example from mysqldump --no-data or pg_dump --schema-only. The tables and columns replace the current ones in the builder, and foreign keys (REFERENCES) are turned into JOIN lines automatically.
Use cases

Common use cases

  • Trying out JOIN construction

    Add tables and join conditions on screen and the SELECT statement is assembled as you go, including INNER / LEFT / RIGHT JOIN. Switch the join type to compare the generated SQL side by side.
  • Drafting aggregate queries

    Pick COUNT, SUM, AVG, MIN or MAX, then add GROUP BY and HAVING to get the skeleton of queries like "orders per customer" or "revenue per month". You can also see how HAVING differs from WHERE.
  • Writing queries that match your schema

    Paste a CREATE TABLE statement and its tables and columns become selectable. You avoid column-name typos while building a SELECT that fits your real schema.
  • Practice and teaching material for SQL beginners

    Each clause has its own input, so learners can match their actions to the output and see the order of SELECT, WHERE, GROUP BY, ORDER BY and LIMIT. Send the result to the SQL formatter to tidy it.
Notes

Notes & limitations

  • It only builds SELECT statements

    SELECT, JOIN, WHERE (including AND / OR, BETWEEN, subqueries and EXISTS), GROUP BY, HAVING, ORDER BY, LIMIT / OFFSET, DISTINCT, UNION / UNION ALL, WITH (CTEs), subqueries in FROM and window functions are supported. INSERT / UPDATE / DELETE are not. Add those parts by hand to the generated SQL.
  • Output is not tailored to one database dialect

    It uses LIMIT / OFFSET, in the style of MySQL, PostgreSQL and SQLite. It does not convert to SQL Server TOP or Oracle FETCH FIRST. FULL JOIN is also unavailable on MySQL. Adjust the SQL for your database before running it.
  • It does not connect to a database

    It neither runs the query nor checks it against a database. Verify that tables and columns exist, and check the results, in your own database. DDL import is parsed in your browser and is not sent anywhere.
  • Do not paste embedded values straight into application code

    Values in WHERE are embedded in the SQL text as quoted literals. When you use the generated SQL in application code, replace the values with bind parameters (placeholders). Concatenating strings leads to SQL injection.
About

About this tool

Visual SQL Query Builder

Automatically generate and assemble SQL statements (SELECT, INSERT, UPDATE, DELETE) using a fully visual, point-and-click interface without typing complex commands manually.
Whether you forget the exact syntax for a complex JOIN or WHERE clause, or simply want to safely draft queries without typographical errors, this no-code SQL generator flexibly accommodates complex conditional structures with ease.

Articles for this tool

Recent Articles