SQL Operators
Description
SQL operators are symbols or keywords used to perform operations on data. They can be classified into several categories.
Different Operators
Arithmetic Operators:
Used to perform mathematical operations.
+
(Addition)-
(Subtraction)*
(Multiplication)/
(Division)%
(Modulo)
Example:
Comparison Operators:
Used to compare two values.
=
(Equal to)<>
or!=
(Not equal to)>
(Greater than)<
(Less than)>=
(Greater than or equal to)<=
(Less than or equal to)
Example:
Logical Operators:
Used to combine multiple conditions.
AND
(Both conditions must be true)OR
(At least one condition must be true)NOT
(Negates a condition)
Example:
Bitwise Operators:
Used to perform bitwise operations.
&
(Bitwise AND)|
(Bitwise OR)^
(Bitwise XOR)
Example:
Set Operators:
Used to combine the results of two or more queries.
UNION
(Combines results of two queries and removes duplicates)UNION ALL
(Combines results of two queries without removing duplicates)INTERSECT
(Returns common results of two queries)MINUS
orEXCEPT
(Returns results from the first query that are not in the second query)
Example:
String Operators:
Used to perform operations on strings.
||
(Concatenation in Oracle and PostgreSQL)+
(Concatenation in SQL Server)LIKE
(Pattern matching)
Example:
Last updated
Was this helpful?