SQL

SQL Server Operators

Arithmetic Operators:

 Addition (+)
 Subtraction (-)
 Multiplication (*)
 Division (/)
 Modulus (%) e.g. 5%2 =1

Comparison Operators:

 Equal to (=)
 Not Equal to (<>)
 Greater than (>)
 Less than(<)
 Greater than or equal to (>=)
 Less than or equal to (<=)

Logical Operators:
 OR ->Used for filtering records satisfying one of the conditions
 AND ->Used for filtering records satisfying multiple conditions
 BETWEEN -> Retrieves the values between max and min values
 EXISTS ->Checks the existence of record in another set
 IN ->Compare a value to the values in the set e.g. Amount IN (10,20,30)
 ANY -> Compare a value to any of the values in another set Amount > Any(10,20,30)
 LIKE ->Compare similar values using wildcards
 ALL ->Compare a value to all values in another set
 NOT->Negation operator e.g. NOT IN

Set Operators:

 Union All ->Combines result sets of 2 SQL statements including duplicates
 Union -> Combines result sets of 2 SQL statements excluding duplicates
 Intersect -> Returns common rows in 2 select statements
 Except ->Returns rows from an SQL Statement that are not in the 2nd SQL Statement.