Schema discovery

Find Relevant Database Tables

Use Schema Discovery to identify the smallest likely set of tables and columns for a question before writing SQL.

How can I find the right database tables before writing SQL?

Describe the information you need in Schema Discovery and select your database system. SQL Mocker generates a metadata-only extraction script for you to run in your own database environment. Attach the returned metadata, review the focused tables and columns it finds, then confirm them and continue to Review Schema before generating SQL.

Start with the information you need

When a database is unfamiliar, you may understand the result you need without knowing its table or column names. Schema Discovery lets you begin with that business question instead of searching the catalogue manually.

For example, you might ask for employee names, department names, and the city where each department is located. SQL Mocker uses that intent to identify likely metadata targets and create an extraction script for the selected database system.

Use the Schema Discovery workflow

1. Select your database system

Open Schema Discovery and choose the database platform you use. SQL Mocker adapts the catalogue queries and syntax to that system.

2. Describe the result in plain English

Explain the information you want returned. Include the main entities, measures, groupings, filters, or dates that could help distinguish the relevant schema areas.

3. Run the metadata extraction script

Review and copy the generated script, then run it in your own database tool. The script searches structural metadata such as table names, columns, data types, keys, and defined references. It does not return production business rows.

4. Attach and confirm the metadata results

Export the returned metadata and attach it to Schema Discovery. SQL Mocker analyses the actual names in the result and presents the smallest likely set of tables with the relevant columns for confirmation.

5. Review the schema and generate SQL

After confirmation, continue to Review Schema to inspect columns, keys, and the relationship/ERD map. Review any missing connections there, then ask the original question so SQL Mocker can generate multi-table SQL from the confirmed context.

Example: employees, departments, and locations

For an Oracle request asking for employee names, department names, and department cities, the returned metadata may confirm EMPLOYEES, DEPARTMENTS, and LOCATIONS. Schema Discovery highlights the relevant name, identifier, and city columns so you can confirm the table set before moving to Review Schema.

Schema Discovery does not need to decide or display the final join path at this stage. Relationships are reviewed in the schema workspace. A possible bridge table is included only when it may be necessary to connect the requested tables.

Your database remains disconnected

Watch the Find Relevant Database Tables demo to see this workflow using Oracle.

  • You run the generated extraction SQL in your own database environment.
  • SQL Mocker does not require database credentials or a live connection.
  • The returned file contains structural metadata rather than production rows.
  • You review and confirm the selected tables before they become SQL-generation context.

How SQL Mocker helps find relevant tables

Describe the information you need, run a database-specific metadata script locally, and attach the results. Schema Discovery narrows the returned structure to a focused set of tables and columns for your review.

Related guides

AI SQL generation

How to Generate SQL for Your Database Without Connecting It to AI

Use extracted schema metadata and natural-language questions to generate SQL tailored to your database without connecting it to AI.

Read guide

SQL generation

How to Select Tables and Review Joins in Generated SQL

Start with the tables you know are relevant, investigate disconnected tables, review bridge tables, and check the joins SQL Mocker generates.

Read guide

Table relationships

How to Find Table Relationships When Foreign Keys Are Missing

Use Investigate Relationships to identify, validate, and confirm likely table connections when foreign-key metadata is missing or incomplete.

Read guide