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.
Exemplo de resposta esperada
É assim que se parece uma resposta correta: ela tem seu próprio número de linhas e não precisa coincidir com as tabelas do esquema. Sua resposta precisa retornar os mesmos nomes de colunas do exemplo: use AS para renomeá-las se for preciso.
| id | product | comment_text |
|---|---|---|
| 1 | Когтеточка «Башня» | Кот в восторге, точит каждый день |
| 2 | Корм «Сытый кот» 2кг | нет комментария |
| 3 | Игрушка «Мышка» | Любимая игрушка! |
Entre para ver seu histórico de envios
EntrarEntre para usar o AI Mentor
Entrar