ADVERTISEMENT
Google AdSense Slot (headerLeaderboard)

Set your Publisher ID in src/config/ads.ts to display live ads.

SQL Database Tutorial• 5 min read

SQL WHERE Clause & Operators

Filtering records with conditions, AND, OR, NOT, and LIKE

The WHERE clause is used to filter records. It extracts only those records that fulfill a specified condition.

Common WHERE Operators

=: Equal to

> / <: Greater than / Less than

>= / <=: Greater or equal / Less or equal

<> or !=: Not equal

BETWEEN: Between a certain range (inclusive)

LIKE: Search for a pattern (e.g., LIKE 'a%')

IN: To specify multiple possible values for a column

Combining Conditions with AND / OR
-- Filter customers from Germany or France with PostalCode > 50000
SELECT CustomerName, City, Country, PostalCode
FROM Customers
WHERE (Country = 'Germany' OR Country = 'France')
  AND PostalCode > 50000;
ADVERTISEMENT
Google AdSense Slot (inContentBanner)

Set your Publisher ID in src/config/ads.ts to display live ads.

Test Yourself With Exercise

+15 XP

Which operator is used to search for a specified pattern in a column?