JAEN

SQL

SELECT ... JOIN

SafeJoin tables

SELECT ... FROM a JOIN b ON a.id = b.a_id;

Combines tables: INNER keeps matches only, LEFT keeps all left rows. Index your join keys.

Examples

  • SELECT u.name, o.total FROM users u LEFT JOIN orders o ON o.user_id = u.id;Users with or without orders

Syntax

SELECT cols FROM a [INNER|LEFT] JOIN b ON cond;

Before you run it

Read only.

Related commands

The same reference, with no signal at all

Every command and flow from this site, held on your device and searchable with no connection. Free to install, no ads.

Get it free on the App Store