Use NOT EXISTS to find artists who don't have any albums in the catalog. This is a common pattern for finding orphan or inactive records.
Write a query using NOT EXISTS to find artists with no albums.
| Column | Type |
|---|---|
| ArtistId | INTEGER (Primary Key) |
| Name | TEXT |
| Column | Type |
|---|---|
| AlbumId | INTEGER (Primary Key) |
| Title | TEXT |
| ArtistId | INTEGER (Foreign Key β Artist.ArtistId) |
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.