4. WHERE: Keep Only the Rows You Need
4.2 Comparison Operators (=, !=, <, >, <=, >=) with Money Examples
Why. Money questions use comparisons every day.
What. Operators: = != <> < > <= >= compare numbers or text.
How. WHERE amount_inr >= 1000 keeps large orders.
Steps
- Find orders of at least 1000 INR.
- Find orders under 500 INR.
- Try != for “not equal”.
Examples
Example 1 · dataset: raja_coffee
SELECT order_id, amount_inr
FROM orders
WHERE amount_inr >= 1000
ORDER BY amount_inr DESC;Output
| order_id | amount_inr |
|---|---|
| 1016 | 1780.0 |
| 1013 | 1680.0 |
| 1007 | 1080.0 |
| 1004 | 1050.0 |
Meaning. Large coffee orders in INR.
Ravindra Bagale's Tip
For money, decide currency first (INR vs USD) — never mix blindly.
Ravindra Bagale's Tip – मराठी
पैशासाठी आधी currency ठरवा (INR vs USD) — आंधळेपणाने मिस करू नका.
Ravindra Bagale's Tip – हिंदी
पैसे के लिए पहले currency तय करें (INR vs USD) — अंधाधुंध मिक्स न करें।