4. WHERE: Keep Only the Rows You Need
4.6 Practice: Filter Coffee Orders by City and Amount
Why. A short filter drill prepares you for interview WHERE questions.
What. Combine comparisons, IN and LIKE on raja_coffee.
How. Write the business question, then the WHERE clause, then SELECT.
Steps
- Nashik orders over 300 INR.
- Customers in Pune or Kolhapur.
- Orders with note text present — next chapter for NULL.
Examples
Example 1 · dataset: raja_coffee
SELECT order_id, city, amount_inr
FROM orders
WHERE city = 'Nashik' AND amount_inr > 300;Output
| order_id | city | amount_inr |
|---|---|---|
| 1007 | Nashik | 1080.0 |
| 1014 | Nashik | 350.0 |
| 1022 | Nashik | 890.0 |
Meaning. Nashik filter drill.
Ravindra Bagale's Tip
Read the result aloud: “These rows are ___ because ___.”
Ravindra Bagale's Tip – मराठी
निकाल मोठ्याने वाचा: “हे रो ___ आहेत कारण ___.”
Ravindra Bagale's Tip – हिंदी
नतीजा ज़ोर से पढ़ें: “ये पंक्तियाँ ___ हैं क्योंकि ___।”