English-to-SQL Bot: Verified In-Memory Execution
Most AI SQL tools hallucinate column names or generate broken JOIN syntax that crashes in production. English-To-SQL creates an isolated in-memory SQLite sandbox, runs the query, verifies the table output, and provides both the query and raw records.
Tested Multi-Table JOIN Example (SQL-LIVE-002)
Below is the verified end-to-end execution of a relational customer orders query:
Schema & English Request
CREATE TABLE customers (id INT, name TEXT); CREATE TABLE orders (id INT, customer_id INT, amount REAL); INSERT INTO customers VALUES (1, 'Alice'), (2, 'Bob'); INSERT INTO orders VALUES (101, 1, 120.50), (102, 1, 45.00), (103, 2, 89.00); Question: Show total spending by each customer, sorted highest first.
Bot Output: Generated & Executed SQL
-- Generated SQL (Verified in SQLite sandbox) SELECT c.name, SUM(o.amount) AS total_spent FROM customers c JOIN orders o ON c.id = o.customer_id GROUP BY c.id, c.name ORDER BY total_spent DESC; Verified Results (2 rows): | name | total_spent | | Alice | 165.50 | | Bob | 89.00 | Status: Success (Executed in 2.1ms)
Dialect Guidance: SQLite vs PostgreSQL vs MySQL
The bot executes on SQLite WASM. When porting queries to larger databases, note these standard dialect differences:
| Feature | SQLite (In-Memory Bot) | PostgreSQL | MySQL / MariaDB |
|---|---|---|---|
| String Concatenation | first || ' ' || last |
first || ' ' || last or CONCAT() |
CONCAT(first, ' ', last) |
| Date Math | date('now', '-7 days') |
CURRENT_DATE - INTERVAL '7 days' |
DATE_SUB(NOW(), INTERVAL 7 DAY) |
| Auto-Increment | INTEGER PRIMARY KEY AUTOINCREMENT |
SERIAL or IDENTITY |
AUTO_INCREMENT |
| JSON Extraction | json_extract(data, '$.key') |
data->>'key' |
data->>'$.key' |
Destructive Query Policy & Security
- Destructive Query Guard: If you request a
DROP TABLE,TRUNCATE, or unconstrainedDELETE, the bot flags a prominent warning and explains production data loss risks before executing in the temporary sandbox. - Stateless Sandbox: Each query session runs in a fresh, isolated database instance. No data persists across turns or requests.
- Safe Pagination: Table output is bounded to 50 rows to prevent browser memory exhaustion.
Frequently Asked Questions
Which SQL dialect is used for execution?
The bot executes queries against an in-memory SQLite (WASM) engine. It converts standard ANSI SQL and highlights PostgreSQL or MySQL differences.
Does English-To-SQL connect to my production database?
No. English-To-SQL operates strictly stateless and in-memory. You provide DDL schemas and optional sample rows in the prompt; no network connection to external databases is made.
What happens if a query generates an execution error?
The engine intercepts the SQLite engine error, executes exactly one automated correction retry, and transparently logs the error and fix in the output.