SQL Practice Logo

SQLPractice Online

Level 10 - MasterDebugging Questionsm2 reliability ha dr multi region

Debug Idempotency Lookup Query

Fix this query used to detect duplicate payment commands: SELECT * FROM payment_commands WHERE LOWER(idempotency_key) = LOWER(:key) AND created_at::date = CURRENT_DATE;

Schema Context

payment_commands(command_id, idempotency_key, tenant_id, created_at), index(idempotency_key, created_at)