Code
Write a SQL query
Turn a plain-language question into SQL against your schema.
What it asks you for
- What you want to knowrequired
- In plain language.
- Your schemarequired
- Tables and columns it can use.
- Dialect
- Which SQL.
What it tells the AI to do
Write {{ dialect | default("postgres") }} SQL for this question:
{{ question }}
Schema:
{{ schema }}
Use only tables and columns present in the schema above. When the question needs
something that is not there, say what is missing and stop. An invented column
name produces a query that runs on a different database than the one you were
given, and the error surfaces hours later.
Return the query, then in two lines: what it assumes, and what it excludes.
Assumptions are where these go wrong (which rows count as active, whether
cancelled orders are revenue, what timezone a date is in).
Prefer a readable query over a clever one. Someone will edit this in six months
and it will not be you.Why this works
Most SQL that comes back wrong is not wrong syntax, it is a wrong assumption about the data: which rows count as active, whether cancelled orders are revenue, what timezone a date column is in. The schema field exists to close that gap, and the query comes back with its assumptions stated so you can correct the assumption instead of debugging the SQL.
Questions
- Why does it ask for my schema?
- So it cannot invent a column. A query written against guessed table names runs against a different database than yours, and the error shows up long after you have stopped watching.
- Which SQL dialects does it handle?
- PostgreSQL, MySQL, SQLite, BigQuery and Snowflake. The dialect changes date functions and window syntax, which is where most portable-looking queries break.
- sql
- query
- database
- data
More code skills
- idapt CodeWork on a real codebase through a paired or cloud computer, including implementation, tests, git, and delivery.
- Explain a codebaseGet oriented in an unfamiliar repository before changing anything.
- Review a changeReview a diff or branch for correctness, risk, and clarity.
- Write testsAdd tests that would actually have caught the bug.
- Build a web appBuild a small web app and deploy it to its own idapt subdomain.
- Write a bug reportTurn a vague complaint into something a developer can reproduce.