4. WHERE: Keep Only the Rows You Need
4.3 How to Filter Text and Numbers (Quotes vs No Quotes)
Why. Forgetting quotes on text is the #1 beginner syntax error.
What. Text values need single quotes: 'Pune'. Numbers do not: 1000.
How. WHERE city = 'Mumbai' AND amount_inr > 700
Steps
- Filter city Goa with quotes.
- Filter amount without quotes.
- Combine both with AND.
Examples
Example 1 · dataset: raja_coffee
SELECT order_id, city, amount_inr
FROM orders
WHERE city = 'Mumbai' AND amount_inr > 700;Output
| order_id | city | amount_inr |
|---|---|---|
| 1002 | Mumbai | 720.0 |
| 1010 | Mumbai | 930.0 |
| 1018 | Mumbai | 840.0 |
Meaning. Mumbai orders over 700 INR.
Ravindra Bagale's Tip
If SQLite says no such column Pune, you forgot quotes around the text.
Ravindra Bagale's Tip – मराठी
SQLite no such column Pune म्हणाले तर टेक्स्टभोवती quotes विसरलात.
Ravindra Bagale's Tip – हिंदी
अगर SQLite no such column Pune कहे तो टेक्स्ट पर quotes भूले हैं।