A formatter made for diffs
One clause per line, one column per line, CASE left on a single line. Keywords uppercased, a stable two space indent, and a one line mode for pasting into a shell or a test.
Pikkola SQL Studio, tool No. 27
Paste a query and read it back formatted, or paste CREATE TABLE and take TypeScript, Zod, Prisma or Pydantic out of it. The same pass marks the statements that will scan a whole table: SELECT *, a DELETE with no WHERE, a LIKE that starts with a wildcard. Nothing is uploaded. The parser is this page.
select o.id,u.email,count(li.id) as items from orders o join users u on u.id=o.user_id where o.created_at > now() - interval '7 days' group by o.id,u.email;
SELECT o.id, u.email, count(li.id) AS items FROM orders o JOIN users u ON u.id = o.user_id WHERE o.created_at > now() - interval '7 days' GROUP BY o.id, u.email;
The studio
The editor is the only input. Formatting, generated code and the findings all come from it, and they update as you type.
No request, no account, no storage. Your SQL, the generated code and the findings live in this page until you close it.
Three readers share one lexer, so what the formatter shows is the same text the type generator and the checker read.
One clause per line, one column per line, CASE left on a single line. Keywords uppercased, a stable two space indent, and a one line mode for pasting into a shell or a test.
CREATE TABLE already carries the types, the nullability, the keys and the references. That is enough to write an interface, a schema and a model that agree with the database instead of drifting from it.
Each finding names the line, says what happens at runtime, and gives the rewrite. There is no single number to chase, because a query can be clean and still slow.
Small rules that keep showing up in code review, in production and on the database bill. They read the text only, so a warning is a question worth asking rather than a verdict.
Line numbers count from the top of the editor. The dialect changes which checks apply.
No. There is no endpoint to send it to. The lexer, the formatter and the schema reader are JavaScript files on this domain, and the Content-Security-Policy on this site allows no script or connection beyond its own files. Load the page once and it keeps working with the network off.
The lexer and the type map. MySQL gets # comments, backticks and tinyint(1) as a boolean. SQLite gets [bracketed] names and its loose type names. PostgreSQL gets dollar quoted strings, :: casts and the serial family. Formatting of standard SQL is identical in all three.
The formatter works on tokens rather than a grammar, so an unfinished statement still comes back spaced and indented instead of throwing. The Types tab needs a real CREATE TABLE; other statements are ignored there, and the Checks tab reads both.
One lookup per dialect, on the column type in the DDL. int becomes number and z.number().int(), varchar becomes string, timestamptz becomes an ISO string in TypeScript and a datetime in Pydantic, a foreign key becomes a relation in Prisma. A type the map does not know comes out as unknown, so you see it instead of trusting a guess.
They cover columns, nullability, defaults, primary keys, unique columns and foreign keys. They do not invent enums, check constraints, indexes or relations to tables you did not paste. The Zod output uses z.string().date() and z.string().datetime(), which need Zod 3.23 or newer.
It changes whitespace and the case of keywords only. Identifiers, string literals, numbers and the order of operators are kept as written. Comments stay where they were, and a -- comment still ends its line.