NL2SQL — natural language to SQL
NL2SQL turns English questions into SQL queries against your seller data. Unlike AI Chat (which gives prose answers), NL2SQL gives you both the SQL and the rows — useful when you want to verify or extend the query, or paste it into a BI tool.
In this guide:
- Open NL2SQL
- Ask a question
- Refine the SQL
- Save a query
- Export results
Prerequisites
- AI quota in your plan.
- Some familiarity with SQL helps — but NL2SQL is also a learning tool for sellers picking up SQL.
Step 1: Open NL2SQL
Go to AI → NL2SQL in the sidebar.
The page is a three-pane layout:
- Question — natural-language input.
- Generated SQL — what NL2SQL produced; editable.
- Result table — rows the query returned.
Step 2: Ask a question
Type a question. Examples:
- “All SKUs that sold zero units last week.”
- “Top 10 buyers by lifetime spend.”
- “Returns rate by SKU in the last 30 days, sorted by highest rate.”
Click Generate. NL2SQL builds the query, runs it (read-only — no writes are ever generated), and shows results.
Step 3: Refine the SQL
You can edit the generated SQL directly and click Run to re-execute. NL2SQL never overwrites your edits unless you click Regenerate from question.
Useful refinements:
- Adjust
LIMITto see more rows. - Add a
WHEREclause to filter further. - Add a
JOINto bring in another table — the schema browser on the right shows what’s available.
Step 4: Save a query
Click Save query to keep a named SQL snippet. Saved queries appear in the left rail and can be re-run with one click. Useful for periodic checks (“weekly returns rate” / “monthly top-100 SKUs”).
Step 5: Export results
The result pane has Download CSV and Copy as JSON actions. For piping into a BI tool, also export the SQL itself (“Copy SQL”).
Safety
NL2SQL only generates SELECT queries. It never produces INSERT, UPDATE, or DELETE, and the database role it runs as is read-only. You cannot mutate data through this tool.
Troubleshooting
- “Couldn’t translate that question.” Rephrase more concretely — name the columns or tables you care about, or break into two questions.
- Result is empty. Either no rows match, or the date range needs widening. Check the SQL’s
WHEREclause. - Query timeout. The query was too expensive. Add a
WHEREto narrow, or aLIMITto cap, then refine.