Search⌘ K

Filtering Rows with WHERE

Learn how to filter rows with a where clause and operators.

Step 1: Start with a question

In Module 1, your queries returned everything. Now let’s get selective. Imagine you work with a table called employees. You might ask:

Write an SQL query to show which employees work in the Engineering department.

This time, you don’t want the entire table, just the rows that meet a specific condition.

Powered by AI
5 Prompts Remaining
Prompt AI WidgetOur tool is designed to help you to understand concepts and ask any follow up questions. Ask a question to get started.

Write a SQL query that shows the first name, last name, and department of employees who work in the Engineering department.

Step 2: Run and observe

AI might return:

MySQL
SELECT first_name, last_name, department
FROM employees
WHERE department = 'Engineering';

Run it. Notice how you’re now seeing fewer rows. That’s because WHERE acts like a filter, it only shows rows that satisfy the rule.

Ask ...