Lesson 2: SELECT, WHERE & Basic Filtering

03 Jul 2026 1 min Swarnil Singhai

SELECT retrieves rows; WHERE filters them — the two clauses you'll write more than any others in SQL.

Real-time example

A support dashboard shows only orders that are still pending, out of thousands of total orders.

SELECT id, customer_id, amount
FROM orders
WHERE amount > 500
  AND created_at >= '2026-07-01';

What's happening

The database evaluates WHERE row by row before returning results — filtering happens before the data ever reaches your application.

Filter as early as possible in the database, not in application code after fetching everything — it's dramatically faster.

Advertisement