Таблица с книгами
Таблица с магазинами
INNER JOIN
SELECT books.id, books.title, shops.nameshop
FROM books
INNER JOIN shops
ON books.id = shops.book_id;
LEFT JOIN
SELECT books.id, books.title, shops.nameshop
FROM books
LEFT JOIN shops
ON books.id = shops.book_id;
RIGHT JOIN
SELECT books.id, books.title, shops.nameshop
FROM books
RIGHT JOIN shops
ON books.id = shops.book_id;
FULL OUTER JOIN
SELECT books.id, books.title, shops.nameshop
FROM books
LEFT JOIN shops
ON books.id = shops.book_id
UNION
SELECT books.id, books.title, shops.nameshop
FROM books
RIGHT JOIN shops
ON books.id = shops.book_id;