Compose a SQL query from a description of what you want, or take a query someone else wrote and get an explanation of what it actually does.
Convert plain English to SQL queries or explain SQL in plain language. Supports SELECT, INSERT, UPDATE, DELETE, JOINs, CTEs, window functions, subqueries, and more. Auto-detects direction.
SQL query appears here...
Two habits make generated SQL safe to use. First, run EXPLAIN before you run the query: a correct query with a sequential scan over ten million rows is still an outage. Second, never run a generated UPDATE or DELETE without wrapping it in a transaction, or converting it to a SELECT first and checking the row count matches what you expect.
The dialects diverge more than people expect. Postgres, MySQL, and SQL Server differ on string functions, date arithmetic, window function support, and upsert syntax: ON CONFLICT versus ON DUPLICATE KEY versus MERGE. A query that is correct in one is frequently a syntax error in another.