Assume the following schema:
users(user_id, created_at, ...)
transactions(txn_id, user_id, amount, txn_ts)
amount
is a positive number for a successful purchase.
Write a SQL query to find the user(s) with the largest total spend in the previous calendar month.
Write a SQL query to find users who have never made a purchase (no rows in transactions).
If you need additional assumptions (timezone, refunds, ties), state them explicitly.