Comparison Operators


 

 

SQLite: Comparison Operators

This SQLite tutorial explores all of the comparison operators used to test for equality and inequality, as well as the more advanced operators.

 

Description:

Comparison operators are used in the WHERE clause to determine which records to select. Here is a list of the comparison operators that you can use in SQLite:

Comparison Operator Description
= Equal
== Equal
<> Not Equal
!= Not Equal
> Greater Than
>= Greater Than or Equal
< Less Than
<= Less Than or Equal
IN ( ) Matches a value in a list
NOT Negates a condition
BETWEEN Within a range (inclusive)
IS NULL NULL value
IS NOT NULL Non-NULL value
LIKE Pattern matching with % and _
EXISTS Condition is met if subquery returns at least one row

 

Some of these operators are fairly straight forward and others are more complicated.