Power Users by Spending
Problem
**[Asked at Databricks]**
Databricks defines a **power user** as a customer whose total spending
across all transactions exceeds **$50 000**.
Find all power users. Return `user_id`, `user_name`, and `total_spend`
(rounded to 0 dp), ordered by total spend descending.
Tables
Example rows — the live problem includes the full dataset.
users
| user_id | user_name |
|---|
transactions
| txn_id | user_id | amount | txn_date |
|---|
Expected output
Your answer should return 3 rows with the columns user_id, user_name, total_spend.
Starter code (SQL)
SELECT *
FROM users;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