Filtering with BETWEEN, IN, and LIKE
Learn advanced filtering techniques for ranges, lists, and patterns.
Learn advanced filtering techniques for ranges, lists, and patterns. This hands-on tutorial focuses on practical implementation of filtering with between, in, and like concepts.
The BETWEEN Operator
The BETWEEN operator selects values within a given range. The values can be numbers, text, or dates. The range is inclusive (begin and end values are included).
Example: Price Range
Find products with a price between 10 and 20.
The IN Operator
The IN operator allows you to specify multiple values in a WHERE clause. It is a shorthand for multiple OR conditions.
Example: Specific Countries
Find customers from Germany, Mexico, or UK.
The LIKE Operator
The LIKE operator is used to search for a specified pattern in a column.
%represents zero, one, or multiple characters._represents a single character.
Wildcard Examples
| Pattern | Description |
|---|---|
'a%' | Starts with "a" |
'%a' | Ends with "a" |
'%or%' | Contains "or" anywhere |
'_r%' | "r" is the second character |
'a__%' | Starts with "a" and has at least 3 characters |
Example: Starts with "A"
Find customers whose name starts with "A".
Example: Contains "or"
Find customers whose name contains "or".