An INNER JOIN only returns matching rows. Use LEFT JOIN to include ALL artists, even those without any albums.
Write a query showing all artists with their album counts, including artists with zero albums.
| Column | Type |
|---|---|
| ArtistId | INTEGER (Primary Key) |
| Name | TEXT |
| Column | Type |
|---|---|
| AlbumId | INTEGER (Primary Key) |
| Title | TEXT |
| ArtistId | INTEGER (Foreign Key → Artist.ArtistId) |
Returns all rows from the left table, plus matching rows from the right. Non-matching right-side rows are NULL.
Ready to take your skills to the next level? Enroll in our comprehensive Data Analyst Career Track to master SQL, Python, Excel, and Power BI.
Run your code to see the result here.