Aug 29, 2017

SQL WHERE clause comparison operators

OperatorDefinitionExample
=EqualWHERE last_name = ‘Michaels’
!= 
<>
Not equal
Not equal
WHERE salary <> 100000
>
>=
Greater than
Greater than or equal to
WHERE salary >= 70000

<=
Less than Less than or equal toWHERE salary <= 85000
IN (...)List of valuesWHERE SALARY IN (70000, 85000, 100000)
BETWEEN ... AND ...Inclusive of two values (and all values between them)WHERE SALARY BETWEEN 70000 and 100000
LIKEDoes pattern matching with wildcard characters % and _WHERE first_name LIKE ‘F%’
IS NULL 
IS NOT NULL
Tests for null values
Tests for non-null values
WHERE manager IS NULL