Build an n8n SQL agent against a small known database
Follow provisioning, dummy data and MCP tools, then compare natural-language answers with results you can verify.
Video in English
Watch on YouTube ↗Prepare the database before asking questions
The March 2025 lesson builds an agent that turns a natural-language question into a database response. Its supplied chapter sequence begins with a demonstration, database provisioning at 2:50 and dummy data at 4:29. A known test dataset makes it possible to distinguish a plausible answer from a correct query result.
- Choose a database you may use for the experiment and follow the provisioning shown in the recording. Keep the selected instance, schema and access context identifiable rather than pointing the first test at unrelated business data.
- Populate the example with a small set of dummy records whose totals and relationships you can inspect. Write two or three questions and their expected answers before connecting the model.
Connect the agent and inspect its database tools
n8n installation appears at 7:56, agent configuration at 9:17 and MCP tools at 11:04, followed by database connection at 13:10. These stages have different responsibilities: the workflow receives the question, the model selects a tool and the database returns the evidence the answer should use.
- Follow the recorded setup and identify the database operations exposed to the agent. Keep the scope aligned with the analysis task and make reading data distinct from changing it.
- Run a simple known question and inspect the generated query or tool activity where available. Compare the returned rows or aggregate with the dummy data before accepting the final natural-language explanation.
Test meaning, not just successful execution
Prompting and tests begin at 21:16. A query can execute successfully while using the wrong filter, grouping or interpretation of a business term. The useful test therefore checks both whether the database call worked and whether it answered the question you actually asked.
- Try a date range or grouping with a known result, then a question that cannot be answered from the supplied schema. Check that the agent does not manufacture a field or unsupported conclusion to fill the gap.
- Revise the instructions for a specific observed mismatch and repeat the original questions. Keep the checked query behaviour, test records and remaining limitations together before extending access to a larger dataset.
The takeaway
Make the database evidence inspectable behind the conversation. The agent is useful when it preserves the meaning of the question and returns a checked result from the intended data.
About this article and its sources
Prepared 2 November 2026 from the published video description and chapters. The actions are editorial follow-along guidance. The full video was not independently watched or transcribed and no new product test was run. Setup, availability and offers may have changed since the recording. The description provides no exact schema, model choice, MCP tool definition or SQL prompt payload; the companion uses the supplied chapter sequence without inventing those details.
