Memra

INNER JOIN: combining tables

Follow a foreign key to another table.

Connect related tables

books.author_id points at authors.id — a foreign key. A JOIN follows that link so you can show columns from both tables together:

SELECT books.title, authors.name
FROM books
JOIN authors ON books.author_id = authors.id;

The ON clause says how rows match up. A plain JOIN (a.k.a. INNER JOIN) keeps only rows that match on both sides. Aliases keep it short — FROM books b JOIN authors a ON b.author_id = a.id.

NORMAL ~/memra/learn/postgresql/inner-join utf-8 LF