⚡
usefultools.dev
SQL

SQL Query Builder – Visual SELECT Generator

NEW

SQL query builder: assemble a SELECT with joins, WHERE groups, GROUP BY, HAVING, ORDER BY and LIMIT, with correct quoting for MySQL, PostgreSQL, SQLite or SQL Server.

Runs 100% in your browser — your input is never uploaded or stored on our servers.

Columns (empty = *)
Joins
=
WHERE
Group
HAVING
ORDER BY

Generated SQL

SELECT
  `u`.`id`,
  `u`.`name` AS `user_name`,
  COUNT(o.id) AS `orders`
FROM `users` AS `u`
LEFT JOIN `orders` AS `o` ON `o`.`user_id` = `u`.`id`
WHERE `u`.`active` = 1
  AND (`u`.`country` IN ('VN', 'FR') OR `u`.`name` LIKE 'O''Brien%')
GROUP BY `u`.`id`, `u`.`name`
HAVING COUNT(o.id) > 5
ORDER BY `orders` DESC
LIMIT 10;

Values that look like numbers are written unquoted (choose "text" to force quotes). Text in parentheses, e.g. COUNT(*), is treated as a raw expression and not quoted.

⚡

Quick Examples

Typical inputs and the results this tool produces.

Quoting
MySQL column u.name
`u`.`name`
Quoting
SQL Server column u.name
[u].[name]
Escaping
name LIKE O'Brien%
LIKE 'O''Brien%'
IN
country IN VN, FR
IN ('VN', 'FR')
Paging
SQL Server LIMIT 10
SELECT TOP (10) *
📖

Overview

This SQL query builder lets you compose a SELECT statement with form fields instead of typing it by hand. Pick the table, the columns and their aliases, add INNER, LEFT or RIGHT joins, combine WHERE conditions in AND/OR groups, then add GROUP BY, HAVING, ORDER BY and paging. The formatted SQL updates as you edit.

It is useful for learning SQL, drafting reports, or getting dialect details right: identifiers are quoted with backticks for MySQL, double quotes for PostgreSQL and SQLite, and square brackets for SQL Server, while string values are escaped by doubling single quotes. LIMIT/OFFSET becomes TOP or OFFSET … FETCH on SQL Server.

The query is generated locally in your browser and is never executed or sent anywhere — no database connection is needed.

Why use this tool?

  • Correct quoting for four SQL dialects
  • Safe escaping of quotes in values
  • Nested AND/OR condition groups
  • Readable, consistently formatted output
  • No database connection required
⭐

Features

🧱

Visual SELECT

Columns with aliases, DISTINCT, table alias and any number of joins.

🔀

Condition groups

Thirteen operators including IN, BETWEEN, LIKE and IS NULL, grouped with AND/OR.

🗄️

Dialect aware

MySQL, PostgreSQL, SQLite and SQL Server quoting and paging syntax.

🛡️

Value escaping

Quotes are doubled, MySQL backslashes escaped and SQL Server Unicode text gets N'…'.

📊

Aggregates

GROUP BY and HAVING with raw expressions such as COUNT(*) or SUM(total).

📋

Copy SQL

Copy the formatted query with one click.

🛠️

How to Use

1

Choose a dialect

Select MySQL, PostgreSQL, SQLite or SQL Server and the FROM table.

2

Add columns and joins

List columns with optional aliases and add joins with their ON columns.

3

Filter and group

Build WHERE conditions, GROUP BY columns and HAVING conditions.

4

Sort, page, copy

Set ORDER BY, LIMIT and OFFSET, then press Copy SQL.

🤔

Frequently Asked Questions