Varan Join the beta →
Varan › How to join different databases

How to join tables from different databases in one query

You have customers in MySQL, orders in PostgreSQL, and a CSV on your desktop — and you need them in one answer. Here's how to JOIN across all of them in a single SQL query, without building a pipeline.

Why it's hard with normal tools

A standard SQL client connects to one database at a time, so a query in your MySQL connection can't see a table in PostgreSQL. The usual workarounds are painful:

What you actually want is to point one engine at all your sources and write a normal JOIN.

The approach: a local, cross-source engine

The trick is a local-first query engine (Varan uses DuckDB) that can read from multiple databases and files at once and run the join on your machine — with read-only access to your sources, no admin rights, and nothing written back.

Step by step with Varan

  1. Connect your sources. Add your MySQL host, your PostgreSQL database, and drag in any CSV or Excel files. Read-only credentials are enough.
  2. Write one query. Reference tables from each source and join them like any normal SQL:
SELECT c.name, o.total, s.tier
FROM   mysql__shop__customers   c
JOIN   pg__analytics__orders    o  ON o.customer_id = c.id
JOIN   read_csv('segments.csv') s  ON s.customer_id = c.id;
-- one result, across MySQL, PostgreSQL and a CSV — no ETL
  1. Run it. The local DuckDB engine pulls only what it needs from each source and returns one joined result — fast, private, repeatable.

Joining specific combinations

Join MySQL and PostgreSQL together

Point Varan at both, then JOIN a table from each in one statement. There's no pipeline and no copying — the engine reads from both live.

Join a CSV or Excel file to a database table

Spreadsheets become queryable tables, so a CSV or Excel file joins to a MySQL or PostgreSQL table in the same query — handy for that one file that never made it into the database.

Do this in your own data

Varan is a desktop app for macOS, Windows and Linux — free during the beta.

Request beta access →

FAQ

Can you join tables from two different databases in SQL?

Not with a plain client — each connects to one server. You need a cross-source engine; Varan runs the join locally across MySQL, PostgreSQL, DuckDB and files.

Is this the same as a federated query?

Similar idea, but local-first and zero-setup. Engines like Trino or Presto do federated queries too, but need infrastructure to run; Varan is a desktop app you point at your sources.

How is Varan different from DBeaver?

DBeaver is a single-database client. See Varan vs DBeaver for the full comparison.