SQLSQL
#2

Filter High-Value Transactions in Price Ranges in SQL

EasyFlipkart
Interview Question #2
Asked at Flipkart

Given a `transactions` table, write a SQL query to select all transactions with an `amount` between $500 and $5,000 (inclusive), excluding transactions marked with `payment_method = 'COD'`. Sort results by `amount` descending.

Input Table: transactions
4 rows preview
txn_idcustomer_idamountpayment_methodcreated_at
T1201450UPI2026-01-01
T22021200.5CREDIT2026-01-02
T32035000COD2026-01-03
T42043400NETBANKING2026-01-04
Expected Output Structure2 rows
txn_idcustomer_idamountpayment_method
T42043400NETBANKING
T22021200.5CREDIT
Interview Context

Asked frequently in data analyst and business analyst technical rounds. Focus on clean filtering, optimal indexing usage, and unambiguous column selection.

SQLPostgreSQL 15
Ready to execute

Click "Run Query" or press Ctrl + Enter to test your query.

Output will be verified against the test dataset.

Chat with us