Enter a table name
Visual SQL query builder for SELECT and DELETE operations. Add fields, conditions, ordering, and pagination to generate clean SQL queries.
What is SQL Query Builder?
SQL Query Builder generates SQL statements through a visual interface instead of manual coding. Rather than memorizing syntax and risking typos, you add fields to select, define WHERE conditions with 12 comparison operators (including LIKE, IN, BETWEEN, and IS NULL), set ORDER BY sorting with ASC/DESC, and configure LIMIT/OFFSET for pagination. The builder supports SELECT and DELETE operations and produces standard SQL compatible with MySQL, PostgreSQL, SQLite, and most other relational databases. It is especially useful for developers learning SQL, building complex filtered queries, or generating statement templates without syntax errors.
How to Use
- Choose your operation: SELECT to retrieve data or DELETE to remove data.
- Enter the target table name (e.g., users, orders, products).
- For SELECT, add fields with optional aliases — click 'Add Field' to include more columns.
- Add WHERE conditions: select a field, choose an operator (=, !=, LIKE, IN, BETWEEN, IS NULL, etc.), and enter a value. Connect multiple conditions with AND or OR.
- For SELECT, add ORDER BY clauses to sort results by one or more fields in ascending or descending order.
- Configure LIMIT and OFFSET for pagination — LIMIT controls how many rows to return, OFFSET skips rows before returning.
Why Use This Tool?
Tips & Best Practices
- Always use WHERE with DELETE to avoid accidentally deleting all rows — the builder makes this explicit.
- Use LIKE with % wildcards for pattern matching: 'text%' matches strings starting with 'text', '%text' matches strings ending with 'text'.
- IS NULL checks for missing values — use it to find records with optional fields that have not been set.
- BETWEEN is inclusive on both ends: age BETWEEN 18 AND 65 includes both 18 and 65.
- Aliases make output column names readable: SELECT first_name AS 'First Name' FROM users.
Frequently Asked Questions
What SQL operations are supported?
SELECT (retrieve data) and DELETE (remove data). SELECT supports fields, WHERE conditions, ORDER BY, LIMIT, and OFFSET. DELETE supports WHERE conditions for targeted deletion. INSERT and UPDATE require different form structures and are not currently supported.
When should I NOT use this SQL Query Builder?
This builder is not suitable for: INSERT or UPDATE statements; queries with subqueries or CTEs (WITH clauses); queries requiring UNION or INTERSECT; complex joins across multiple tables (use the SQL Join Generator instead); or stored procedure calls. For these, write SQL directly in your database client.
What operators are available?
Comparison: =, !=, <, >, <=, >=. Pattern: LIKE (with % wildcards), IN, NOT IN. Null checks: IS NULL, IS NOT NULL. Range: BETWEEN. These cover most common filtering needs in web applications and data analysis.
How do WHERE conditions work?
Each condition filters rows. Multiple conditions connect with AND (all must be true) or OR (any can be true). The first condition has no connector; subsequent conditions add AND/OR before the condition. For complex logic requiring parentheses, extend the generated SQL manually.
What's the difference between LIMIT and OFFSET?
LIMIT restricts result count (e.g., LIMIT 10 returns max 10 rows). OFFSET skips rows before returning (e.g., OFFSET 5 LIMIT 10 returns rows 6-15). Together they enable pagination: page 2 with 10 items per page is OFFSET 10 LIMIT 10.
Is my SQL query data sent to any server?
No. The SQL Query Builder runs entirely in your browser. No table names, column names, or query data is transmitted to any server. The generated SQL is produced locally using JavaScript. You can safely build queries referencing internal database schemas.
Real-world Examples
Paginated user search with filtering
A SELECT query that finds active users whose names match a search term, sorted by creation date, with pagination for page 3.
Operation: SELECT Table: users Fields: id, name AS 'User Name', email, created_at WHERE: status = 'active' AND name LIKE '%john%' ORDER BY: created_at DESC LIMIT: 20, OFFSET: 40
SELECT id, name AS 'User Name', email, created_at FROM users WHERE status = 'active' AND name LIKE '%john%' ORDER BY created_at DESC LIMIT 20 OFFSET 40;
Targeted deletion of expired records
A DELETE query that removes sessions that have expired, using IS NULL to also catch records with missing expiry dates.
Operation: DELETE Table: sessions WHERE: expires_at < '2025-01-01' OR expires_at IS NULL
DELETE FROM sessions WHERE expires_at < '2025-01-01' OR expires_at IS NULL;