Tuesday, October 28, 2014

Types of Operators in SQL Server 2008

Here, I’m going to discuss types of operators that SQL Server 2008 uses. But, before I go ahead I would like to mention what an Operator is.
An operator is nothing but a sign or symbol that specifies an action on one or more expressions called operands.
We can organize SQL Server operators into 8 major categories:
1. Arithmetic Operators: Perform mathematical operations on one or more than one expression of numetic data type. Following are the arithmetic operators offerred by SQL Server 2008:
  • (+) Add: Addition
  • (-) Subtract: Subtraction
  • (*) Multiply: Multiplication
  • (/) Divide: Division
  • (%) Modulo: Remainder of a division
2. Assignment Operators: (=) Equal sign is the assignment operator that SQL Serve 2008 supports. It is used not only to perform equality but also to give an alias name to a column.                                                                                                                                            
3. Bitwise Operators: Perform bit manipulations between two expressions of integer data type. There are threee bitwise operators in SQL Server 2008:
  • (&) Bitwise AND:
  • (|) Bitwise OR
  • (^) Bitwise Exclusive OR
4. Comparison Operators: Checks whether two expressions are the same or not. Always returns True or False. Following are the comparison operators supported by SQL Server 2008:
  • = (Equals to)
  • > (Greater than)
  • < (Less than)
  • >= (Greater than or equal to)
  • <= (Less than or equal to)
  • <>, != (Not equal to)
  • !< (Not less than)
  • !> (Not greater than)
5. Logical Operators: Checks for truth of some condition. Return either True or False or Unknown value. Following is the list of logical operators:
  • ALL
  • AND
  • ANY
  • BETWEEN
  • EXISTS
  • IN
  • LIKE
  • NOT
  • OR
  • SOME
6. Scope Resolution Operators: Scope resolution operator :: provides access to static members of a compound data type. I know you wish to know about compound data type now. Will write about it later on.
7. 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.
8. Unary Operators: Unary operators perform an operation on only one expression of any one of the data types of the numeric data type category. Follwoing is the list of unary operators in SQL Server 2008:
  • (+) Positive
  • (-) Negative
  • (~) Bitwise NOT

No comments:

Post a Comment