backendgym backendgym · reps Sign in with GitHubSign in

06Keep the orphan author

sql-querying / reps/06/README.md

Show every author with the number of distinct books they wrote, including authors with no rows in the join table. Order by book count, highest first, then by name.

answer.sql is a query an assistant might well write. Read it first, then run it and compare with the expected result below. Fix it so every author is there.

Expected once fixed: 7 rows. Rowan Byrne is there with 0, Georgi Gospodinov has 3 books and Yoko Tawada has 2. The shipped file returns 6 rows.

After the rep
  1. 1 Which side of the join lost Rowan Byrne, and what does a LEFT JOIN keep that an inner join drops?