Comparison Operators (Transact-SQL)

Oracle, PL SQL, SQL Server,

Where clause must have one condition statement in Select statement.
To restrict depending upon condition min requirement is an operator.

1. Relation Operator
2. Logical Operator
3. Arithmetic Operator

1. Relation Operator :

Operator Times of use
= (Equals) Equal to
> (Greater Than) Greater than
< (Less Than) Less than
>= (Greater Than or Equal To) Greater than or equal to
<= (Less Than or Equal To) Less than or equal to
!= (Not Equal To) Not Equal To
<> (Not Equal To) Not equal to (not ISO standard)
!> (Not Greater Than) Not greater than (not ISO standard)
!< (Not Less Than) Not less than (not ISO standard)

Ex:
SELECT * FROM employee
where salary > 20000

SELECT * FROM employee
where salary !< 20000 

2. Logical Operator:

OperatorTimes of use
ORThe row to be selected at least one of the conditions must be true.
ANDA row to be selected all the specified conditions must be true.
NOTA row to be selected the specified condition must be false.

3. Arithmetic Operator :


OperatorTimes of use
+ (Add)Addition
- (Subtract)Subtraction
* (Multiply)Division
% (Modulo)Returns the integer remainder of a division.

0 Comments