Convert everyday language into SQL queries and get the data you want
Text to SQL - turn a question into a query
View full example (opens in a new tab)SQLAI's text-to-SQL generator turns a description of the data you need into a SQL query. It works with a live database connection or an imported schema, so the query uses your real tables, columns and dialect instead of a generic example. The result is a first draft you can review, run and refine in a conversation.
Describe the query you need
Write the question the way you would ask a colleague: customers who signed up last month, revenue by month for the current year, duplicate email addresses, the top ten products by units sold. SQLAI turns that intent into a query with the right SELECT, filters, joins, grouping and ordering for your engine.
The generator handles more than simple lookups. It can produce joins across several tables, aggregates and HAVING clauses, CTEs, subqueries, window functions, pagination and dialect-specific date and string functions. When the request is ambiguous, the AI states its assumptions so you can correct them in the next message rather than discovering the problem after the query runs.
Try the Text-to-SQL demo to see a full conversation.
Use your schema for accurate SQL
The most common reason a generated query fails is a wrong table or column name. SQLAI avoids that by using your schema as context. Connect a supported database or import an exported schema as DDL, JSON, CSV or documentation, then ask your question against the real structure.
Schema context also improves relationships. The AI can see which tables join, which columns are keys and which fields are likely to be filters. On large databases you do not need to paste the whole schema into the prompt; SQLAI looks up the parts that matter for the question. We have tested it in-house with schemas containing close to 1,000 tables.
Optional database rules add the conventions a schema cannot express: required tenant filters, naming standards, a preferred join style, disallowed patterns or a mandatory date range. Schema autosuggest helps while you write, suggesting valid tables, columns and relationships so you spend less time correcting typos. See all supported databases for live connections, import support and version coverage.
SQLAI does not automatically run generated queries against your database. You review the query and decide when and where to execute it. Result rows are not added to the conversation automatically, and the privacy policy explains what is stored.
Refine the query in a conversation
A query is rarely finished on the first try. The generator keeps the thread, so you can add a filter, change the time window, replace a subquery with a CTE or ask why a join was chosen. Follow-up questions use the same schema and assumptions, which makes the conversation a working record of how the query was built.
From the same context you can move to the other generators: validate the SQL before running it, optimize a slow query, or explain a query you inherited. Conversations can be shared read-only with teammates by invitation or link.
Convert a query to another dialect
If you already have SQL and need it for a different engine, paste the query and describe the source and target dialects. The generator can rewrite dialect-specific functions, casting, quoting, date handling, pagination and identifier rules while keeping the query's intent. Review the rewrite and validate it for the target engine; conversion is not a guarantee that every construct has an exact equivalent.
Supported databases
Text-to-SQL works across relational, analytical and NoSQL engines. Supported SQL databases include PostgreSQL, MySQL, MariaDB, SQL Server, Oracle PL/SQL, SQLite, IBM DB2, Snowflake, BigQuery, Redshift, ClickHouse, Trino, Presto, Vertica, SAP HANA, Teradata, Firebird, InterBase, Sybase and Microsoft Access. Non-SQL engines include MongoDB, Splunk SPL, Salesforce SOQL/SOSL, PartiQL, Neo4j, Cassandra, GraphQL and others.
The exact public API names and version coverage are listed on the supported databases page. If you work across engines, the SQL optimizer and SQL validator use the same dialect context.
Who it is for
- Analysts who know the question but not the exact schema or SQL syntax.
- Developers who need a first draft for an application query and want to review it before shipping.
- Product and operations teams answering an ad-hoc question without waiting for an engineer.
- DBAs and analytics engineers exploring an unfamiliar database or a legacy schema.
- SQL learners who want to see how a plain-language request becomes a real query.
Frequently asked questions
What is text to SQL?
Text to SQL is the process of turning a natural-language description of the data you need into a SQL query. SQLAI uses your schema and selected database dialect to generate a query you can review and run, rather than a generic snippet that may not match your tables.
Do I need to connect a database first?
No. You can start with a question and no schema, although attaching a schema produces more accurate table and column names. Connect a supported database or import an exported schema as DDL, JSON, CSV or documentation. You can also select an engine and version without a schema.
Which databases are supported?
SQLAI supports more than 30 SQL and NoSQL engines, including PostgreSQL, MySQL, SQL Server, Oracle, SQLite, BigQuery, Snowflake, Redshift, ClickHouse, MongoDB, Splunk and Salesforce. See all supported databases and versions for the current list and the public API engine names.
How do I improve the generated SQL?
Add your schema, select the right engine and version, and use database rules for conventions such as tenant filters or naming standards. If the first answer makes an assumption you did not intend, correct it in the conversation. You can then validate the query and compare the corrected version before running it.
Does SQLAI run the generated query?
No. SQLAI does not automatically execute generated queries against your database. You review the SQL and run it yourself, or use a read-only connection in the app where one is available. Result rows are not added to the conversation automatically.
Can I share a generated query with my team?
Yes. Conversations can be shared read-only by invitation or link, and imported schemas can be shared with teammates who need the same context. Only the owner can continue a shared conversation.
Review before production
AI-generated SQL can contain errors. Review table and column names, join conditions, filters and dialect-specific functions before running a query in production. Test on a copy or with a read-only role, compare the result with the question you asked, and use the SQL validator for a second pass.