SQL for Backend Engineers · SQL problem

Large Card Payments From Webhooks

A free sql problem from the JSONB and SQL/JSON skill. Read it here, then solve it in the app.

  • Easy
  • SQL problem
  • Free

The problem

The payment provider's webhooks are stored as they arrive, in webhook_events.payload:

{"type": "payment.succeeded", "data": {"amount": 12500, "currency": "usd", "method": "card"}}

Amounts are in cents. Risk review wants every succeeded card payment of at least 100.00 (10000 cents):

columnmeaning
idthe event's id
amount_centsthe amount, as a number
currencythe currency code, as text (usd, not "usd")

Sort by id.

Constraints

Older integrations send amount as a JSON string ("12500") instead of a number, and some events have no method.

How it's graded

  • Your SQL runs on PostgreSQL 18. Run compares your rows with the expected rows on the sample data; Submit runs it against hidden datasets built to catch the classic mistakes.
  • Stuck? Hints come in four steps, from a nudge to a code skeleton, each costing part of the points.

More problems in JSONB and SQL/JSON

Write the query Large Card Payments From Webhooks free

No card needed. Lessons, practice questions and easy problems are free forever.

Free plan, no card · 7-day Pro trial · Cancel anytime