Lesson 7. Complex Data Filtering
Last updated
Last updated
Data can be filtered in a lot of different ways. You can be very specific in order to get exactly what you want.
Filters are built with logic operators. The logic operators in SQL are very much like the logic operators you will find in any language.
Filtering Individual Columns
The following are the logic operators for filtering individual columns.
Operator | Operator Description |
---|---|
Combining Individual Filters
Combining filters requires the use of two additional operators.
AND for when you want both conditions to be true
OR for when you want either condition to be true
Combining filters can be quite complex and confusing. For readability and your own sanity, I recommend that you keep everything straight by using parentheses to clearly group your logic.
A Full Set Of Filtering Examples
=
Equals
<>
Does not equal
<
Less than
>
Greater than
<=
Less than or equal to
>=
Greater than or equal to
!=
Does not equal
!<
Is not less than
!>
Is not greater than
BETWEEN, AND
Is between two values inclusive of those values
NOT BETWEEN, AND
Is not between two values inclusive of those values
IS NULL
Where the value is null
IS NOT NULL
Where the value is not null