Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Idempotent Insert

A payment callback may be delivered twice with the same txn_id. Write an INSERT that stores the payment once and silently ignores the duplicate.

Table schema

Payments(txn_id VARCHAR(20) PRIMARY KEY, amount INT)

Sample data

Statement executed twice: insert ('T100', 500)

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.