🚀 New batches open: Advanced Excel • Power BI • SQL • AI for Analytics — Book a free demo
Home / SQL Tutorial / Day 2

Day 2 — Filtering rows with WHERE

Yesterday you chose columns. Today you choose rows — which is where SQL starts saving you real time.

The WHERE clause

WHERE goes after FROM and keeps only the rows that match your condition.

SELECT columns FROM table WHERE condition;

Comparison operators

  • = equal to
  • <> not equal to (some databases also accept !=)
  • > < greater than, less than
  • >= <= greater or equal, less or equal

Not equal

Text is in quotes, numbers are not

This is the single most common beginner error.

Wrong WHERE City = Noida — the database looks for a column called Noida and fails.
Right WHERE City = 'Noida'

Filtering on dates

Dates are written as text in 'YYYY-MM-DD' format and compare in the order you would expect.

Why this matters at work

Every MIS report you will ever build is a WHERE clause: this month, this region, this status. Get comfortable here and half of reporting is done.

Try these yourself

  1. Find all customers in Delhi.
  2. Find orders with an Amount below 30000.
  3. Find products that cost more than 5000.
  4. Find employees who are not in the Sales department.
  5. Find orders placed in April 2026 (OrderDate from 2026-04-01).

Want this taught properly?

This tutorial covers the basics. Our SQL course in Noida takes you through window functions, CTEs and stored procedures on a real database, with projects and mentor support.

See the SQL course →