sqlask

Ask a database a question in plain English. A model writes one SQLite SELECT, a read-only guard checks it, SQL errors and suspicious empty results go back to the model for another try, and you get a short answer plus the exact query used.

question›schema summary›model writes SQL›read-only guard›execute›retry on error (max 3)›answer + SQL

Loading the database in your browser...

Replay a recorded run

Recorded run

The model calls below were recorded once and are replayed here, step by step. Earlier attempts and their statuses are recorded playback. Only the final SQL and the gold query pass through the guard and execute live in your browser with sql.js to verify the result. Verification compares complete results up to 100,000 rows; larger results or timeouts are not scored live. The answer text is recorded too.

Run your own SQL

Live, read-only, in your browser

Your query goes through the same guard as the model's (a JavaScript port of guard.py, tested against the same cases): one statement, SELECT or WITH only, no write keywords, and a LIMIT 200 added or capped. The database is also opened with query_only, and a query that runs longer than 8 seconds is stopped.

Try:
Tables in the database

Eval scoreboard

Execution accuracy on 40 questions with hand-written gold queries: a run counts as correct when its result rows equal the gold result (order ignored unless the question asks for one, numbers rounded to 2 decimals, extra columns allowed).

Schema "full" is the prompt the pipeline normally uses: tables, columns, types, keys and a few sample values per column. "bare" drops the sample values (an ablation on the 6 questions most likely to need an exact stored value). Retried counts questions that needed more than one attempt; "x2" in the table below marks them. Strict also requires the same number of columns as the gold query.

This first set was too easy. Both models scored 40 of 40, so it does not separate them, and the retry loop fired once per model. Chinook is a very widely used sample database and the models write defensive filters for it (LIKE '%hip%hop%', IN ('United Kingdom', 'UK')) even with no sample values in the prompt. The harder set below runs on a disguised copy.

Every scored question

Select a row to replay it above.

Harder set: disguised Chinook

The same rows rebuilt under unfamiliar names (Track becomes catalog_item, Invoice becomes checkout), every date shifted by 2,963 days and 9 h 30 min, prices multiplied by 75, track length in seconds, and some stored values replaced ('Hip Hop/Rap' is 'Urban / Rap', 'USA' is 'US', 'United Kingdom' is 'GB'). 20 harder questions with hand-written gold queries: joins across up to five tables, window functions, date boundaries, ties, NULL traps, and values that are or are not shown in the schema summary. Same pipeline, same scoring, retry loop on.

The disguise removed the memorised names and values, but it still did not separate the models: Sonnet 5.5 and Haiku 5.5 both scored 19 of 20 and missed the same question. The retry loop now does real work: for the United Kingdom question both models first tried 'United Kingdom' and 'UK', got an empty result, and reached 'GB' with a wider IN (...) list (Haiku on attempt 2, Sonnet on attempt 3). The one miss is "heavy metal": the summary shows only three of the 25 style labels, the first guesses (LIKE '%Heavy%', = 'heavy metal') came back empty, and the retry LIKE '%metal%' also counted the separate 'Metal' style (402 instead of 28), which looks plausible, so nothing flagged it. The date-boundary, tie and NULL traps caught neither model.

Every question in the harder set

Select a row to replay it above; the query and the gold query run live on the disguised database.