Skip to content

Comparison Operators

M-SQL Operator Description Example
> Greater than select * from `films` where id > 10
select (id>10) as exprVal from `films`
< Less than select * from `films` where id < 10
select (id<10) as exprVal from `films`
= Equal to select * from `films` where id = 10
select (id=10) as exprVal from `films`
>= Greater than or equal to select * from `films` where id >= 10
select (id>=10) as exprVal from `films`
<= Less than or equal to select * from `films` where id <= 10
select (id<=10) as exprVal from `films`
!= Not equal to select * from `films` where id != 10
select (id!=10) as exprVal from `films`
IS NOT NULL Is not null select * from `films` where id IS NOT NULL
IS NULL Is null select * from `films` where id IS NULL
LIKE String like, support standard %, case insensitive select `First Name` as FName from `customers` where `First Name` Like 'M%'
GT Greater than select GT(id,10) as exprVal from `films`
LT Less than select LT(id,10) as exprVal from `films`
EQ Equal to select EQ(id,10) as exprVal from `films`
GTE Greater than or equal to select GTE(id,10) as exprVal from `films`
LTE Less than or equal to select LTE(id,10) as exprVal from `films`
NE Not equal to select NE(id,10) as exprVal from `films`
IN In a list of values select * from `customers` where `Address.City` in ('Japan','Pakistan')
NOT IN Not in a list of values select * from `customers` where `Address.City` NOT IN ('Japan','Pakistan')
CASE Case statement select id,(case when id=3 then '1' when id=2 then '1' else 0 end) as test from customers