SQL comparison operators allow you to test if two expressions are the same. The result of a comparison can be TRUE, FALSE, or UNKNOWN (an operator that has one or two NULL expressions returns UNKNOWN). List of operators that can be used while specifying condition are

OperatorDescription
=Equal to
!=Not Equal to
<Less than
>Greater than
<=Less than or Equal to
>=Greater than or Equal to
Comparison Operator

Equal To Operator

Equal To operator compares the equality of two expressions. It returns true if the value of the left expression is equal to the value of the right expression; otherwise, it returns false. Syntax of this operator is

expression1 = expression2

Not Equal To operator compares two non-null expressions and returns true if the value of the left expression is not equal to the right one; otherwise, it returns false. Syntax of this operator is

expression1 != expression2

Greater Than Operator

Greater Than Operator compares two non-null expressions and returns true if the left operand is greater than the right operand; otherwise, the result is false. Syntax for the same is

expression1 > expression2

Greater Than or Equal to operator compares two non-null expressions. The result is true if the left expression evaluates to a value that is greater than the value of the right expression. Following illustrates the syntax of this operator

expression1 >= expression2

Less Than Operator

Less than operator compares two non-null expressions. The result is true if the left operand evaluates to a value that is lower than the value of the right operand; otherwise, the result is false. The following shows the syntax of the less than operator:

expression1 < expression2

Less Than or Equal to operator compares two non-null expressions and returns true if the left expression has a value less than or equal the value of the right expression; otherwise, it returns true. Below is the syntax of this operator:

expression1 <= expression2

Example

SELECT 4 = 5        /* Output : 0 */
SELECT 4 != 5       /* Output : 1 */
SELECT 5 > 4        /* Output : 1 */
SELECT 4 >= 4     /* Output : 1 */
SELECT 5 < 4       /* Output : 0 */
SELECT 4 <= 4    /* Output : 1 */

Reference

SQL Comparison operator