Relationship-aware SQL generator
Generate accurate multi-table SQL from reviewed table relationships.
SQL Mocker helps identify, review, and complete the connections between your tables before generating SQL. This gives the AI the context needed to build reliable joins without connecting directly to your database.
Identify likely connections
SQL Mocker analyses table, column, and key metadata to suggest how related tables may connect.
Review relationships
Inspect, correct, or manually add table connections and join columns before generating SQL.
Generate with context
Give the assistant reviewed relationship paths for more reliable joins and multi-table queries.
Complete the missing context
A database connection cannot provide relationships that were never defined.
Some databases do not clearly record how their tables connect. AI text-to-SQL assistants that rely only on a direct connection may miss this context and cannot reliably generate accurate multi-table SQL.
SQL Mocker makes those connections reviewable. You can confirm suggested relationships, correct the selected columns, or create a missing connection manually before asking the assistant to write SQL.
From undefined metadata to a reviewed relationship
Imported metadata
Connection not defined
Reviewed in SQL Mocker
The assistant can now follow a reviewed join path between customers and location.
How relationship-aware SQL generation works
- 1
Add your database structure
Extract, upload, or build the tables and columns you want to query.
- 2
Review table connections
Confirm suggested relationships or add missing connections and join columns manually.
- 3
Ask a natural-language question
Describe the result you need using the table and column context available in your workspace.
- 4
Review the generated SQL
Inspect the joins, filters, aggregations, and mock results before running the query in your database.
Multi-table SQL example
Generate SQL using reviewed relationships
The assistant follows the confirmed orders-to-customers and customers-to-location paths.
SELECT
l.city,
SUM(o.total_amount) AS total_order_value
FROM orders AS o
INNER JOIN customers AS c
ON o.customer_id = c.customer_id
INNER JOIN location AS l
ON c.location_id = l.location_id
WHERE o.order_date >= '2026-01-01'
AND o.order_date < '2027-01-01'
GROUP BY l.city
ORDER BY total_order_value DESC;Your database remains unchanged
Complete relationships in your workspace, not in production.
Relationships reviewed or created in SQL Mocker are stored only with your SQL Mocker project. They do not add keys, constraints, or any other changes to your real database.
You remain in control of the final query. Review and test all generated SQL in your own database environment before relying on its results.
Relationship-aware SQL generator FAQ
What is a relationship-aware SQL generator?
It uses reviewed connections between tables, including the columns that join them, when generating multi-table SQL. This provides more context than table and column names alone.
Why do table relationships matter when generating SQL?
They tell the assistant which tables can be joined and which columns should be used. Missing or incorrect relationships can lead to invalid joins, duplicate rows, or inaccurate results.
What if my database does not define foreign keys?
SQL Mocker can suggest likely connections from the available metadata. You can review, correct, or manually create the relationship before generating SQL. Suggestions should always be verified against your database logic.
Does SQL Mocker change relationships in my database?
No. Relationships created or corrected in SQL Mocker remain in your SQL Mocker workspace and do not alter your real database.
Does SQL Mocker connect AI directly to my database?
No. SQL Mocker works from schema metadata that you provide and does not request database credentials or create a live connection to your database.