All Type Coding

Search Here

What is operator and its type in sql server.?

An operator is a symbol specifying an action or reserved word or a character used primarily in an SQL statement's. Operators are used to  performed on one or more expressions.There are different types of Operator in sql server .These are given below....
1.            Arithmetic operators
2.            Comparison  operators
3.            Logical operators
4.            Bitwise operators
5.            Assignment operator
6.            Unary operators
7.            String concatenation operator

Arithmetic operators
Arithmetic operators are used to perform mathematic operations on multiple expressions.These are given below.
Operator                         Meaning

+                                     Addition 
-                                      Subtraction
*                                      Multiplication
/                                      Division
%                                    Return the integer reminder of a division.




Compound/Assignment Operators
Operators
Meaning
+=
Add and assign means It will add some value to the original value and stored in result in original value
-=
Subtract and assign means It will Subtract some value to the original value and stored in result in original value
%=

Modulus and assign means It will divided by  value to the original value and stored in result in original value

*=

Multiply and assign means It will multiply by 

value to the original value and stored in 

result in to original value

/=
Divide and assign means It will divide by  value to the original value and stored in result in to original value
&=
Bitwise AND and assign
|=
Bitwise OR and assign
^=
Bitwise XOR and assign

For Example.






Comparison Operator

Operators
Meaning
=
Equal to.
!= or <>
Not equal to.
Greater than.
Less than.
!<
Not less than.
!>
Not greater than.
<=
Less than equal to.
>=
Greater than equal to.















Logical Operators:

Checks for truth of some condition. Return either True or False or Unknown value. Following is the list of logical operators:

1.                   ALL
2.                   AND
3.                   ANY
4.                   BETWEEN
5.                   EXISTS
6.                   IN
7.                   LIKE
8.                   NOT
9.                   OR
10.                SOME

 Bitwise Operators: 
 Perform bit manipulations between two expressions of integer data type. There  are three bitwise operators in SQL Server

1.                    (&) Bitwise AND:
2.                    (|) Bitwise OR
3.                   (^) Bitwise Exclusive OR


 String Concatenation Operators:


 The plus sign (+) is the string concatenation operator used to concatenate two or more strings of  String data type i.e. char, varchar, etc.

Unary Operators:

 Unary operators perform an operation on only one expression of any one of the data types of the numeric data type category.

1.                   (+) Positive
2.                   (-) Negative
3.                   (~) Bitwise NOT

No comments :

Post a Comment