3. SELECT Basics: Read Rows Without Changing Data
3.5 How to Preview Safely with LIMIT
Why. LIMIT protects you from scrolling 100,000 rows by accident.
What. LIMIT n returns at most n rows.
How. Put LIMIT at the end: SELECT … FROM … LIMIT 10;
Steps
- Run without LIMIT on a small table — fine.
- Add LIMIT 5 and compare.
- Keep LIMIT while learning.
Examples
Example 1 · dataset: raja_coffee
SELECT name, city FROM customers LIMIT 3;Output
| name | city |
|---|---|
| Asha Patil | Pune |
| Omar Khan | Mumbai |
| Sofia Mendes | Goa |
Meaning. Only three customers — preview mode.
Ravindra Bagale's Tip
LIMIT alone does not pick “top” by amount — you need ORDER BY too (chapter 5).
Ravindra Bagale's Tip – मराठी
फक्त LIMIT रकमेनुसार top निवडत नाही — ORDER BYही लागतो (chapter 5).
Ravindra Bagale's Tip – हिंदी
अकेला LIMIT राशि से top नहीं चुनता — ORDER BY भी चाहिए (chapter 5)।