Given this sample dataset:
item
----
item_id item_name item_added
1 Apple <date_time>
2 Banana <date_time>
user
----
user_id user_name
1 Alice
2 Bob
3 Carol
rating
------
rating_id item_id user_id rating_value
1 1 1 3
2 1 2 4
3 1 3 5
4 2 1 5
5 2 2 2
I have this query to figure out which items are missing only one rating:
SELECT item.*,
COUNT(rating_value) AS rating_count
FROM item
LEFT JOIN rating ON item.item_id = rating.item_id
GROUP BY item_id
HAVING rating_count = 2
ORDER BY item_name
How can I modify this query to show items that are only missing Carol's rating? The rating_count row is not essential. The only essential columns are item_id and item_name.
Thank you.