Flagged Support Messages
Problem
A help-desk inbox stores customer messages in support_messages(message_id, body). A message is flagged for review when it breaks any of these limits: the body is longer than 60 characters, it contains more than 3 tilde characters ('~'), or it contains more than 3 asterisk characters ('*'). Return the message_id of every flagged message, ordered ascending.
Tables
Example rows — the live problem includes the full dataset.
support_messages
| message_id | body |
|---|---|
| 1 | Order delayed, please help ~ contact ~ escalate ~ refund ~ urgent ~ thanks |
| 2 | Tracking ref *AB12 and ref *CD34 both stuck at depot |
| 3 | My parcel never arrived even though the app said delivered yesterday |
Expected output
Your answer should return 7 rows with the columns message_id.
Starter code (SQL)
SELECT *
FROM support_messages;Solve this SQL question free
Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.
Solution & explanation
Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.
Sign up free to unlock