QueryBuilder4DelphiGitHub ↗

THE QUERY WORKBENCH

SQL in. Delphi out.

Turn a SELECT query into fluent QueryBuilder4Delphi code. Everything runs in your browser; your SQL stays on your device.

01 SQL inputSELECT

Ctrl+Enter (⌘Enter) to convert · Tab to indent · Escape, then Tab to leave the SQL editor.

Ready to convert.

02 Delphi output

What can I convert?

One SELECT statement with table and column aliases, DISTINCT, INNER/LEFT/RIGHT JOIN with one column comparison, CROSS JOIN, AND/OR conditions with SQL precedence, NOT (…), column comparisons, LIKE, IN, BETWEEN, IS NULL, GROUP BY, HAVING, ORDER BY and literal paging values. SQL Server TOP and OFFSET/FETCH are also supported.

COUNT, SUM, AVG, MIN and MAX in the select list become SelectCount, SelectSum and so on; aggregates in HAVING and ORDER BY become HavingRaw and OrderByRaw with parameterized values. Subqueries work in IN, NOT IN, EXISTS, NOT EXISTS and comparisons, and are generated as nested TQuery.Create chains.

CTEs, unions, derived tables in FROM, other functions and expressions, COUNT(DISTINCT …), complex JOIN conditions, placeholders, quoted identifiers containing spaces or punctuation, and dialect-specific extensions are rejected. The message quotes the unsupported part and suggests the fluent or raw method to use instead; no partial code is emitted. Zero row limits and MySQL string literals with backslash escapes are rejected because their meaning cannot be preserved reliably.

Ordinary decimals produce natural Delphi literals such as 19.99, without BCD wrappers or extra imports. Decimals are limited to 15 significant digits (ignoring insignificant zeros) within the normal Double range; high-precision values, subnormal values and scientific notation are rejected. Binary floating-point parameters do not guarantee exact SQL DECIMAL semantics. Exact parameter types depend on your schema: choose Currency, TBcd or another Delphi type manually when needed. Signed integer values retain exact Integer/Int64 validation.

The output is a complete BuildQuery: IQuery function. Compile it with your chosen TSqlDialect in Delphi; the converter does not execute SQL or run the Delphi compiler. PostgreSQL unquoted identifiers are folded to lowercase. SQL comments are not included in the output.