List of SQL Server Comparison Operators

Below is a list of T-SQL comparison operators that you can use in SQL Server.

OPERATORMEANING
=Equal to
>Greater than
<Less than
>=Greater than or equal to
<=Less than or equal to
<>Not equal to
!=Not equal to (not ISO standard)
!<Not less than (not ISO standard)
!>Not greater than (not ISO standard)

What are Comparison Operators

T-SQL comparison operators compare two expressions. The result of a comparison operator has the boolean data type. These are typically known as “Boolean expressions”.

Comparison operators can be used inside your SQL queries to filter data to a certain criteria.

Here’s an example.

SELECT Name, Population
FROM country
WHERE Population > 100000000
ORDER BY Population DESC;

Result:

+--------------------+--------------+
| Name               | Population   |
|--------------------+--------------|
| China              | 1277558000   |
| India              | 1013662000   |
| United States      | 278357000    |
| Indonesia          | 212107000    |
| Brazil             | 170115000    |
| Pakistan           | 156483000    |
| Russian Federation | 146934000    |
| Bangladesh         | 129155000    |
| Japan              | 126714000    |
| Nigeria            | 111506000    |
+--------------------+--------------+

In this example I used the Greater Than operator (>) to select only countries with a population greater than 100000000.