Under the hood
-- The frontend needs the result of that query to display the 'list view'
-- which cannot be performed, because books and authors are on different databases
SELECT books.title, authors.firstName, authors.lastName
FROM books
INNER JOIN authors ON authors.id = books.id
WHERE books.title LIKE 'Found%'-- Step 1: Query database containing books (including foreign key)
SELECT books.title, books.authorId FROM books WHERE books.title LIKE 'Found%';
> | title | authorId |
> | Foundation | 83948934 |
-- Step 2: Query database containing authors (including pk)
SELECT authors.id, authors.firstName, authors.lastName FROM authors WHERE id IN (83948934);
> | id | firstName | lastName |
> | 83948934 | Isaac | Asimov |
-- Step 3: Merge results (using books.authorId === authors.id)
> | title | authorId | firstName | lastName |
> | Foundation | 83948934 | Isaac | Asimov |Last updated