How many Types of Operators in SQL?

Operators in SQL:

In SQL, an operator operates on variables and performs an action in a program. It consists of words o symbols. For instance, the arithmetic operators (+) and (-) cause us to add or subtract two numbers respectively. It used to perform arithmetic or string operations on variables. There are mainly 8 types of operators in SQL.

Types of Operators in SQL:

1. Logical Operators: Logical operators such as AND, OR, and NOT are used to determine the logical relationships among various values.

AND Operator: The AND Operator evaluates TRUE if both the operands are TRUE else it returns FALSE.

OR Operator: The OR Operator evaluates to TRUE if either operand is TRUE. But if both the operands are FALSE then it returns FALSE.

NOT Operator: The NOT Operator is used to reverse the result. It returns TRUE if the operand is FALSE, and it returns FALSE if the operand is TRUE.

2. Comparison Operators: These operators would compare one expression with another. The result is always TRUE, FALSE, or NULL. Typically, you use comparison operators in the WHERE clause of SQL data manipulation statements and conditional control statements.

3. Relational Operators: These operator allows you to compare arbitrarily complex expressions.

4. IS NULL Operator: It returns the boolean value TRUE if its operand is null or FALSE if it is not null.

5. LIKE Operator: These operators used to compare a character value to performance. LIKE returns the boolean value TRUE if the character patterns match or FALSE if they do not match. The pattern matched by LIKE can include two special-purpose characters called Wild-Cards. An underscore (_) matches exactly one character and a per cent sign (%) matches zero or more characters.

6. Between Operator: Between Operator tests whether a value lies in a specified range or not. It means “greater than or equal to a low value and less than or equal to a high value”.

7. IN Operator: IN Operator tests set membership. This set can contain nulls, but they are ignored.

8. Concatenation Operator: This operator used to append one string into another. Double vertical bars (||) serve as the concatenation operator.