Ad space (banner)
🗄️SQL Lessons
Lesson 3 / 50

Filtering Rows with WHERE

This lesson covers filtering rows with WHERE, so you can pull out just the data you need from a much larger table. It's for anyone searching "SQL WHERE clause" or "SQL filter rows."

WHERE lets you keep only the rows that match a condition, using comparison operators like score >= 80. Narrowing a huge table down to exactly what you need is one of the most common things you'll do with a database.

The example adds WHERE score >= 80 to pull out only students who scored 80 or above, and also narrows the columns to SELECT name, score — notice how combining both keeps the result compact and focused.

A common early mistake is forgetting quotes around string comparisons — WHERE name = Alice throws an error; it needs to be WHERE name = 'Alice'. Numbers and strings are compared differently, and once that clicks, the other comparison operators (=, <>, >, <) feel intuitive, since they match what you already know from other languages.

SQL
OUTPUT

💡 The SQL engine may take a few seconds to load the first time you run code.

Ad space (banner)
Ad space (in-article)