The payments team at a marketplace wants to review large UPI transactions from the first quarter of 2026 before running a chargeback audit.
From the shipment_orders table, return the order_id, customer_name, order_date and order_value for every order that was paid using UPI, placed between 1 January 2026 and 31 March 2026 (inclusive), and worth more than 5000.
Sample data
Table: shipment_orders
14 row(s) · showing first 8
| order_idINT | customer_nameTEXT | order_dateDATE | order_valueNUMERIC(10,2) | payment_modeTEXT | cityTEXT |
|---|---|---|---|---|---|
| 7101 | Ira Bansal | 2026-01-04 | 8450.00 | UPI | Pune |
| 7102 | Devansh Rao | 2026-01-09 | 4200.50 | UPI | Indore |
| 7103 | Nikhil Sarin | 2026-01-17 | 12999.00 | Credit Card | Delhi |
| 7104 | Mahima Sethi | 2026-01-28 | 6100.00 | UPI | Kolkata |
| 7105 | Yusuf Ali | 2026-02-02 | 999.00 | Cash on Delivery | Bhopal |
| 7106 | Prerna Iyer | 2026-02-11 | 15750.75 | UPI | Chennai |
| 7107 | Sagar Naik | 2026-02-19 | 5000.00 | UPI | Panaji |
| 7108 | Rhea Kapoor | 2026-02-25 | 7325.40 | Net Banking | Mumbai |
shipment_orders
- order_idINT
- customer_nameTEXT
- order_dateDATE
- order_valueNUMERIC(10,2)
- payment_modeTEXT
- cityTEXT
- Step 1: Start from `shipment_orders` and project only the four columns the audit needs — `order_id`, `customer_name`, `order_date`, `order_value`.
- Step 2: Filter the payment channel with `payment_mode = 'UPI'`. String comparison in Postgres is case-sensitive, so match the stored casing exactly.
- Step 3: Restrict the date range with `order_date BETWEEN DATE '2026-01-01' AND DATE '2026-03-31'`. `BETWEEN` is inclusive on both ends, which is exactly what the requirement asks for.
- Step 4: Add the value threshold `order_value > 5000`. Use `>` (not `>=`) so the ₹5000 order is excluded.
- Step 5: All three predicates are combined with `AND`, so a row must satisfy every condition to be returned.
SELECT order_id, customer_name, order_date, order_value
FROM shipment_orders
WHERE payment_mode = 'UPI'
AND order_date BETWEEN DATE '2026-01-01' AND DATE '2026-03-31'
AND order_value > 5000;Learn the concept first
Stuck on WHERE & Filtering? These free SQL lessons teach it step by step.
More WHERE & Filtering questions
Practising alone only goes so far — our live cohorts pair SQL depth with dashboards, agentic analytics projects and mock interviews.
Explore the program