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:

  • Access the table selector
  • Select a table
  • Ask a question in natural language
  • View results and the generated SQL

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

Visit the direct URL /ai/db.

ℹ️
NL2SQL is not linked in the sidebar today. Access it via the direct URL.

You’ll see a grid of available database tables. These are the datasets you can query.

Step 2: Select a table

Click a table card to open the NL2SQL conversation interface for that table. The AI Assistant will open with NL2SQL mode active.

Step 3: Ask a question

Type a question about the selected table in natural language. 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.”

Press Enter. NL2SQL generates the query, runs it (read-only — no writes are ever generated), and shows results.

Step 4: View results and SQL

The AI Assistant displays the results and shows the generated SQL. You can copy the query to use elsewhere, such as pasting into a BI tool.

Safety

NL2SQL is designed to generate only SELECT queries and operates with a read-only database role to prevent data mutation. The client restricts generated output to read operations; backend enforcement of these restrictions is delegated to your database role permissions.

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 WHERE clause.
  • Query timeout. The query was too expensive. Add a WHERE to narrow, or a LIMIT to cap, then refine.

Related articles