Menu
easy99 Speedmart · text

Clean up messy product names

A supplier feed imported product names with stray whitespace and inconsistent casing. For each product, return:

- id - clean_name: the name with leading/trailing whitespace removed - brand: the first word of the cleaned name, in uppercase

Assume the brand is always the first space-separated word.

Schema

products
idINT
raw_nameTEXT

Example input

products
↑ Read the question

The interviewer's next question

The catalog team also wants a word_count for each cleaned name — how many space-separated words it has, ignoring the leading/trailing padding.

Solving follow-ups — the questions an interviewer actually asks next — unlocks with a Basic plan.

See Basic plans

RM 25/mo · cancel anytime

Add product_desc: everything in the cleaned name *after* the brand (the first word), trimmed. For "Nestle Milo 1kg" that's "Milo 1kg"; for "Dettol Soap" it's just "Soap".

Solving follow-ups — the questions an interviewer actually asks next — unlocks with a Basic plan.

See Basic plans

RM 25/mo · cancel anytime

Keep going

Company names are trademarks of their respective owners, used here only to describe practice material. mahir_data is not affiliated with, endorsed by, or sponsored by any company named on this site. Terms.