EASYasked at 1 company

The Number of Rich Customers

A easy-tier problem at 77% community acceptance, tagged with Database. Reported in interviews at athenahealth and 0 others.

Founder's read

The Number of Rich Customers is a straightforward SQL problem that athenahealth has asked. With a 77% acceptance rate, it's easier than average, which makes failing it in a live OA worse for your score since interviewers assume you practiced the basics. The problem tests whether you can write a clean GROUP BY query with a HAVING clause to filter aggregated results. You've probably written this pattern a hundred times, but under pressure during screen share, it's easy to botch the WHERE versus HAVING distinction. StealthCoder sits invisible during your assessment and handles it in seconds if you blank on the syntax.

Companies asking
1
Difficulty
EASY
Acceptance
77%

Companies that ask "The Number of Rich Customers"

If this hits your live OA

The Number of Rich Customers is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE.

Get StealthCoder
What this means

This is a classic aggregate filtering problem. The trap is conflating row-level filters (WHERE) with group-level filters (HAVING). You'll read the problem, count something per customer, then realize you need to filter groups, not rows. Most candidates write WHERE instead of HAVING, query fails, and they waste time debugging. The real work is understanding that HAVING operates on aggregated columns after GROUP BY, not on the raw data. If you've prepped database problems, you've seen this. If you haven't, it's a learnable mistake. The problem lives in the Database topic category and sits at easy difficulty, so athenahealth expects most candidates to solve it correctly on the first attempt. If you hit this live and the GROUP BY syntax escapes you, StealthCoder surfaces the working query invisibly.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

The Number of Rich Customers recycles across companies for a reason. It's easy-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE. Works on HackerRank, CodeSignal, CoderPad, and Karat.

The Number of Rich Customers interview FAQ

Is this problem still being asked at athenahealth?+

Yes. It's confirmed in recent reports from athenahealth interviews. With a 77% pass rate, it's a baseline database skill they filter for. If you're interviewing there, you should expect SQL fundamentals like this one.

What's the key trick to solving it?+

Use HAVING, not WHERE, to filter groups after aggregation. WHERE filters rows before GROUP BY. HAVING filters groups after. That distinction is the whole problem. Master it and this is a 2-minute solve.

How does this relate to GROUP BY and aggregation?+

It's a direct application of GROUP BY with COUNT or SUM, then filtering the result set with HAVING. You aggregate per customer, then keep only groups that meet a threshold. It's the textbook use case for HAVING.

Will I see similar problems in other database OAs?+

Frequently. Aggregate filtering is a core SQL pattern. If you understand HAVING and GROUP BY here, you'll recognize the pattern in similar problems across different companies.

What happens if I get the WHERE and HAVING logic backwards during my OA?+

Your query returns wrong results or errors. You'll spend minutes debugging instead of moving on. At 77% acceptance, most candidates get this right, so a mistake here stands out to the screener. Know the distinction before your assessment.

Want the actual problem statement? View "The Number of Rich Customers" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.