#783

Users with net revenue of at least 100

The finance director wants to see users whose net revenue is at least 100 — i.e. the sum of purchases minus refunds per user lands at 100 or higher. For each user compute the net revenue (purchase events count positively, refund events count negatively; refund amounts are already stored with a negative sign in the data) and keep only those whose net revenue is at least 100. Return the user id and their net revenue, ordered by revenue descending.

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.

netuser_id
400.003
300.001
100.004

Your query result will appear here