Drop Unrated Reviews, Replace Empty Comments
Drop Unrated Reviews, Replace Empty Comments
At "Kotomarket" customers leave reviews on products. The reviews table is flat: one review per row. Not every review is filled in completely — sometimes the customer left no rating (rating is NULL), and sometimes they wrote no text (comment is NULL).
The moderation team is preparing a review feed and asks for an export following two rules:
1. Show only reviews that have a rating — that is, rating is not NULL. Reviews without a rating must be excluded.
2. If a review has no text (comment is NULL), output the placeholder string 'нет комментария' instead of the empty value. If text exists, output it as is.
Return three columns: id, product, and the comment text under the alias comment_text.
Use IS NOT NULL for the filter and COALESCE for the placeholder substitution. No sorting is required — row order does not matter.
Expected output sample
This is what a correct answer looks like — its row count is its own, it doesn't have to match the schema tables. Your answer must use the same column names as this sample — alias them with AS if needed.
| id | product | comment_text |
|---|---|---|
| 1 | Когтеточка «Башня» | Кот в восторге, точит каждый день |
| 2 | Корм «Сытый кот» 2кг | нет комментария |
| 3 | Игрушка «Мышка» | Любимая игрушка! |
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign in