Ravindra BagaleCourses & study guides Track your progress

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

  1. Run without LIMIT on a small table — fine.
  2. Add LIMIT 5 and compare.
  3. Keep LIMIT while learning.

Examples

Example 1 · dataset: raja_coffee

SELECT name, city FROM customers LIMIT 3;

Output

namecity
Asha PatilPune
Omar KhanMumbai
Sofia MendesGoa

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).