Revenue for Every User
The product mart must show revenue for every user from a_users. Sum amount from a_events only for kind = 'purchase'; if there are no purchases, show 0. Return id and revenue, sorted by id.
Expected output sample
This is what a correct answer looks like — its row count is its own, it doesn't have to match the schema tables.
| id | revenue |
|---|---|
| 1 | 50 |
| 2 | 0 |
| 3 | 50 |
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign in