SQL
WHERE Clause
Filter records based on conditions.
By TechCoder TeamLast updated: 2026-06-02
In a Nutshell
Filter records based on conditions. This hands-on tutorial focuses on practical implementation of where clause concepts.
WHERE Clause
The WHERE clause is used to filter records. It extracts only those records that fulfill a specified condition.
Syntax
SELECT column1, column2
FROM table_name
WHERE condition;
Operators
The following operators can be used in the WHERE clause:
| Operator | Description |
|---|---|
| = | Equal to |
| > | Greater than |
| < | Less than |
| >= | Greater than or equal |
| <= | Less than or equal |
| <> or != | Not equal |
Logical Operators
AND: Displays a record if all conditions are TRUE.OR: Displays a record if any of the conditions are TRUE.NOT: Displays a record if the condition is NOT TRUE.
Examples:
-- Select customers from Mexico
SELECT * FROM Customers WHERE Country = 'Mexico';
-- Select customers with ID greater than 10
SELECT * FROM Customers WHERE CustomerID > 10;
-- AND Example
SELECT * FROM Customers WHERE Country = 'Germany' AND City = 'Berlin';