Query Execution (NL2SQL)
Learn how to convert natural language to SQL and execute queries through MCP clients.
What is NL2SQL?
NL2SQL (Natural Language to SQL) is a feature that automatically converts natural language questions into SQL queries. Since NeoSQL's MCP server provides database schema information to the AI, you can query the data you want even without knowing exact table or column names.
How to Use
Use NL2SQL from an MCP client to generate and execute queries.
Enter Question in MCP Client
Request a data query in natural language from Claude Desktop, Cursor, etc.
Example: "Show me the list of users who signed up in the last 30 days and placed at least one order."
SQL Generation & Execution
The AI generates an SQL query based on schema information and executes it on the database through NeoSQL's MCP server.
View Results
The execution results are displayed in the MCP client. The AI may also summarize results or provide additional analysis.
Query Examples
Example questions you can use in MCP clients.
| Natural Language Question | Generated SQL Type |
|---|---|
| "Show me the total number of users" | SELECT COUNT(*) |
| "Top 10 orders by amount in descending order" | SELECT ... ORDER BY ... LIMIT |
| "Show monthly sales totals" | SELECT ... GROUP BY ... SUM() |
| "List of users with no orders" | SELECT ... LEFT JOIN ... WHERE ... IS NULL |
| "Compare this week's sign-ups to last week" | Subquery or CTE |
The more specific your question, the more accurate the generated SQL. Instead of "sales", say "sum of total_amount from the orders table" for better results.
