The two expressions are compared using the comparison operator.
Let us assume two variables "A" and "B", the value of "A" is 50 and the value of "B" is 100.
Camparsion Operators
Operator | Operation | Description |
---|---|---|
= | Equal to | Check both operands value that are equal or not,if yes condition become true. |
> | Greater Than | Check the left operand value is greater than right Operand, if yes condition becomes true. |
< | Less Than | Check the left operand value is less than right Operand, if yes condition becomes true. |
>= | Greater Than or equal to | Check that the value of left operand is greater than or equal to the value of right operand or not,if yes condition become true. |
<= | Less Than or equal to | Examines that the value of left operand is less than or equal to the value of right operand or not, if yes condition becomes true. |
<> | Not equal to | Check the operand's value equal or not, if values are not equal condition is true. |
Examples :
- Equal to ( = ) :
SELECT * FROM customers WHERE Address = 'Meerut';
- Greater Than ( > ) :
SELECT * FROM customers WHERE Salary > 7000;
- Less Than ( < ) :
SELECT * FROM customers WHERE Salary < 7000;
- Greater Than or Equal to ( >= ) :
SELECT * FROM customers WHERE Salary > = 3500;
- Less Than or Equal to ( <= ) :
SELECT * FROM customers WHERE Salary <=3500;
- Not Equal to ( < > ) :
SELECT * FROM customers WHERE Salary < > 5000;
0 Comments