T-SQL 101: #21 Comparison operators in T-SQL

We use comparison operators in T-SQL expressions. And the expressions are often used in WHERE clauses. For example:

WHERE CreditLimit = 10000

The = (equals) sign shown is a simple one but T-SQL has a number of operators.

Most people writing T-SQL code are familiar with these:

= Equals
<> Does not equal
< Less than
> Greater than
<= Less than or equals
>= Greater than or equals

However, less people seem to be aware of the other operators added a while back:

!= Does not equal (synonym for <> does not equal)
!< Not less than (synonym for >= greater than or equals)
!> Not greater than (synonym for <= less than or equals)

Learning T-SQL

It's worth your while becoming proficient in SQL. If you'd like to learn a lot about T-SQL in a hurry, our Writing T-SQL Queries for SQL Server course is online, on-demand, and low cost.

Leave a Reply

Your email address will not be published. Required fields are marked *