SQL Query Builder — SELECT Generator

Assemble a SELECT from tables, columns, joins and conditions and read the SQL it produces, which is a faster way to learn joins than staring at syntax.

How to use

  1. Pick the tables and columns you want.
  2. Add joins and where conditions.
  3. Copy the generated SELECT statement.

Frequently asked questions

What is the difference between an inner and a left join?

Inner keeps only rows matched on both sides. Left keeps every row from the left table, filling the right side with NULL where there is no match.

Why did my join multiply the row count?

Because the join key is not unique on one side. Each left row pairs with every match, so a one-to-many join returns the many count, not the one.

Where do conditions go, WHERE or ON?

Filters on the left table go in WHERE. A filter on the right table of a left join must go in ON, or the NULLs get filtered out and the join behaves as inner.

Is the generated SQL portable?

It sticks to standard syntax, which runs on Postgres, MySQL and SQLite. Vendor-specific functions and dialect quirks are yours to add.

Last updated

Powered by maratool