The data earlier was ideal: Every book had an author and every author had a book. But the real world is not so ideal. A book may have no sales, or the author isn’t in the system.
The query used in the previous section is called an inner join. It requires that each result row have a row from both the left and right tables; otherwise, the row doesn’t make it to the result.
Consider a new author table where there’s an author who hasn’t written any books:
sqlite> SELECT * FROM author;id first_name last_name--- ---------- ----------1 Sean Walberg2 Ross Brunson3 Ada Lovelacesqlite> SELECT * FROM book WHERE author_id= 3;sqlite>
The report on books and authors doesn’t even ...