INNER JOIN in practice
Show columns from two tables side by side.
JOIN (also written INNER JOIN) makes one combined row for every pair of rows that match the ON condition. You can then SELECT columns from either table, filter with WHERE and sort as usual. Short table nicknames, called aliases, keep queries readable: FROM loans l JOIN members m ON l.member_id = m.id.
SELECT m.name, l.loan_date
FROM loans l
JOIN members m ON l.member_id = m.id;l is short for loans and m for members. Each loan row now carries the borrower's name.
An inner join drops rows that have no match. Hana Sato has never borrowed a book, so she does not appear in the result above. The next lesson shows how to keep her.