You're working as a data analyst for a digital library platform, and you need to identify which books in the catalog are missing ratings. This information is crucial for the recommendation system to decide which books need more user engagement to generate ratings.
Given a books table with columns for book_id, title, author, published_year, and rating, your task is to find all books that haven't been rated yet (where rating is NULL).
Your Goal: Write a SQL query to retrieve all books with NULL ratings, ordered by book_id in ascending order. Return all columns except the rating column since we already know it's NULL.
Note: This is a fundamental SQL problem that teaches you how to handle NULL values using the IS NULL condition.
Input & Output
Visualization
Time & Space Complexity
Single scan through all records in the table
Space for k records that match the NULL condition
Constraints
- 1 โค book_id โค 106
- 1 โค title.length, author.length โค 100
- 1800 โค published_year โค 2024
- rating can be NULL or a decimal between 0.0 and 5.0