Menu
hardShopee · windowBasic

Split customers into spending quartiles

Marketing wants customers split into 4 equal-sized spending quartiles, where 1 is the lowest-spending group and 4 is the highest-spending group.

Return customer, total_spend, and quartile.

Schema

customer_spend
customerTEXT
total_spendNUMERIC

Basic

The example input, expected output, and walkthrough for this question unlock with a Basic plan.

↑ Read the question

Basic

This is a Basic question

Premium practice questions unlock with a Basic plan. The full solution, expected output, and grading are available to Basic members.

See Basic plans

RM 25/mo · cancel anytime

The interviewer's next question

Marketing only wants the VIP list this time: return customer and total_spend for just the customers in quartile 4 (the highest-spending group).

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

See Basic plans

RM 25/mo · cancel anytime

Marketing changes its mind: split customers into 5 equal-ish spending groups instead of 4, same low-to-high direction. Return customer, total_spend, quintile.

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.